diff --git a/HomeWork/js/script.js b/HomeWork/js/script.js index 215a3b4..8894f9b 100644 --- a/HomeWork/js/script.js +++ b/HomeWork/js/script.js @@ -1,6 +1,9 @@ //***1*** // Робота зі змінними // Оголосіть дві змінні: name та city. +// let name = "Іван"; +// let city = `${name}`; +// console.log(city); // Присвойте значення "Іван" змінній name. // Скопіюйте значення зі змінної name в city. // Виведіть значення змінної city, використовуючи функцію console.log (яка повинна показати “Іван”). @@ -8,32 +11,40 @@ //***2*** //Який буде результат виконання скрипта? // let name = "Olga"; -// console.log(`привіт ${1}`); // -// console.log(`привіт ${"name"}`); // -// console.log(`привіт ${name}`); // ? +// console.log(`привіт ${1}`); // привіт 1 +// console.log(`привіт ${"name"}`); // привіт name +// console.log(`привіт ${name}`); // привіт Olga //***3*** -//Видобути число зі змінних +// //Видобути число зі змінних // let a = "5"; // let b = "13cvb"; // let c = "12.9sxdcfgv"; // вивести в консоль тип +// console.log(typeof Number(a)); +// console.log(typeof parseInt(b)); +// console.log(typeof parseFloat(c)); //***4*** //Зробіть, щоб 0.1 + 0.2 = 0.3 +// console.log((0.1 * 10 + 0.2 * 10) / 10); //***5** //Поверніть найбільше число с набору 20, 10, 50, 40 +// console.log(Math.max(20, 10, 50, 40)); //***6** //Поверніть випадкове число в діапазоні від 2 до 4 +// console.log(Math.random() * (4 - 2) + 1); //***7** //дізнатись довжину message // const message = "Welcome to Bahamas!"; +// console.log(message.length) // 19 //***8** //вивести в консоль message великими літерами +// console.log(message.toUpperCase()); //***9** // створити пустий об*єкт @@ -42,6 +53,22 @@ // видалити місто // додати буль з ключем: like flowers // вивести результат в консоль +// let human = { + +// }; +// human.name = "Oleh"; +// human.age = 26; +// human.city = "Kyiv"; +// console.log(human); +// delete human.city; +// human['like flowers'] = true; +// console.log(human); + //***10** // За допомогою циклу “for…in” вивести в консоль ключі і значення об*єкта + +// for (key in human) { +// console.log(key); +// console.log(human[key]); +// } \ No newline at end of file