An open API service indexing awesome lists of open source software.

https://github.com/lorussogiacomoluca/commonjs-modules

Exercise #37 - 14/04/2025
https://github.com/lorussogiacomoluca/commonjs-modules

backend commonjs javascript nodejs

Last synced: about 1 month ago
JSON representation

Exercise #37 - 14/04/2025

Awesome Lists containing this project

README

          

# 📘 Esercizio 37

**esercizio di oggi:** `commonjs-modules`
**nome repo:** `commonjs-modules`

📦 **Lavoriamo con i moduli CommonJS** esportando e importando valori e funzioni.
Segui questi tre step creando i rispettivi files:

---

## 1️⃣ - `names.js`

1. 🧠 Crea una funzione che accetta due parametri: `firstName`, `lastName`.
La funzione dovrebbe restituire un oggetto con le proprietà `firstName` e `lastName`.

2. 📤 Esporta la funzione dal file.

---

## 2️⃣ - `hobbies.js`

1. 🎯 Crea una funzione che accetta tre parametri: `hobbyOne`, `hobbyTwo`, `hobbyThree`.
La funzione dovrebbe restituire un array di stringhe contenenti gli hobby.

2. 📤 Esporta la funzione dal file.

---

## 3️⃣ - `people.js`

1. 📥 Importa la tua funzione da `names.js`.

2. 📥 Importa la tua funzione da `hobbies.js`.

3. 🧩 Crea una funzione che non ha parametri.
La funzione dovrebbe restituire un oggetto con due proprietà: `fullName` ed `hobbies`.
All'interno della tua funzione, usa le tue due funzioni precedenti per costruire l'oggetto.