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
- Host: GitHub
- URL: https://github.com/lorussogiacomoluca/commonjs-modules
- Owner: lorussogiacomoluca
- Created: 2025-04-14T12:05:52.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-14T13:36:36.000Z (about 1 year ago)
- Last Synced: 2025-04-14T17:14:03.685Z (about 1 year ago)
- Topics: backend, commonjs, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.