├── 2 ├── userService.js ├── index.js ├── data.js └── app.html ├── app.js ├── mathOperations.js └── index.html /2/userService.js: -------------------------------------------------------------------------------- 1 | import { users } from './data.js'; 2 | function getUserNames() { 3 | return users.map(user => user.name); 4 | } 5 | export { getUserNames }; -------------------------------------------------------------------------------- /2/index.js: -------------------------------------------------------------------------------- 1 | import { users } from './data.js'; 2 | 3 | function getUserNames() { 4 | return users.map(user => user.name); 5 | } 6 | 7 | export { getUserNames }; 8 | -------------------------------------------------------------------------------- /2/data.js: -------------------------------------------------------------------------------- 1 | const users = [ 2 | { id: 1, name: 'Sardorbek', age: 24 }, 3 | { id: 2, name: 'Olim', age: 22 }, 4 | { id: 3, name: 'Aziza', age: 21 } 5 | ]; 6 | export { users }; 7 | 8 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | import { add, subtract, multiply } from './mathOperations.js'; 2 | console.log("qushish:", add(5, 3)); 3 | console.log("ayirish:", subtract(10, 4)); 4 | console.log("ko'paytirish:", multiply(2, 6)); -------------------------------------------------------------------------------- /mathOperations.js: -------------------------------------------------------------------------------- 1 | function add (a, b){ 2 | return a + b 3 | } 4 | function subtract(a, b) { 5 | return a - b; 6 | } 7 | 8 | function multiply(a, b) { 9 | return a * b; 10 | } 11 | 12 | export { add, subtract, multiply }; -------------------------------------------------------------------------------- /2/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |