From bed468660050fe7b95990b36241e824b5c2c1a94 Mon Sep 17 00:00:00 2001 From: codevadym Date: Wed, 5 Feb 2025 10:26:41 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 34-array-of-objects/start.js | 28 ++++++++++++++++++++++++++++ 35-object-iteration/start.js | 8 ++++++++ 36-random-numbers/start.js | 4 ++++ 3 files changed, 40 insertions(+) diff --git a/34-array-of-objects/start.js b/34-array-of-objects/start.js index 16e28d5..0bc04e2 100755 --- a/34-array-of-objects/start.js +++ b/34-array-of-objects/start.js @@ -11,3 +11,31 @@ * * 4. Выведите результирующий массив в консоль */ + +const cars = [ + { + carBand: 'BMW', + price: 1000, + insAvalibleForSale: true, + }, + { + carBand: 'Porsche', + price: 1100, + isAvailableForSale: false, + }, + { + carBand: 'Moscvich', + price: 1200, + isAvailableForSale: true, + } +] + +const newCar = { + carBand: 'Lada', + price: 1200, + isAvailableForSale: true, +} + +cars.push(newCar) + +console.log(cars) \ No newline at end of file diff --git a/35-object-iteration/start.js b/35-object-iteration/start.js index 63121cf..51aef6c 100755 --- a/35-object-iteration/start.js +++ b/35-object-iteration/start.js @@ -13,3 +13,11 @@ const myObject = { key4: null, key10: NaN, } + +const objectKeys = Object.keys(myObject) + +objectKeys.forEach((key) => { + if (key === 'key1' || key === 'key3') { + console.log(myObject[key]) + } +}) diff --git a/36-random-numbers/start.js b/36-random-numbers/start.js index ebfd755..84f50b5 100755 --- a/36-random-numbers/start.js +++ b/36-random-numbers/start.js @@ -18,3 +18,7 @@ const MIN = 1000 const MAX = 9999 const myNumbers = [2355, 7235, 8135, 1762, 2361, 8351] + +const randomNumber = Math.floor(Math.random() * (MAX - MIN + 1)) + MIN; + +console.log(randomNumber); \ No newline at end of file