diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..1419147 --- /dev/null +++ b/css/index.css @@ -0,0 +1,11 @@ +body { + background-color: rgba(49, 61, 55, 0.87); +} + +h1 { + text-align: center; + margin: 150px; + font-size: 140px; + text-shadow: 2px -4px 16px #ba5df0; +} +/*# sourceMappingURL=index.css.map */ \ No newline at end of file diff --git a/css/index.css.map b/css/index.css.map new file mode 100644 index 0000000..70a11e2 --- /dev/null +++ b/css/index.css.map @@ -0,0 +1,9 @@ +{ + "version": 3, + "mappings": "AAAA,AAAA,IAAI,CAAC;EACJ,gBAAgB,EAAE,sBAAsB;CACxC;;AACD,AAAA,EAAE,CAAC;EACF,UAAU,EAAE,MAAM;EAClB,MAAM,EAAE,KAAK;EACb,SAAS,EAAE,KAAK;EAChB,WAAW,EAAE,GAAG,CAAE,IAAG,CAAC,IAAI,CAAC,OAAiB;CAC5C", + "sources": [ + "index.scss" + ], + "names": [], + "file": "index.css" +} \ No newline at end of file diff --git a/css/index.scss b/css/index.scss new file mode 100644 index 0000000..55b8f12 --- /dev/null +++ b/css/index.scss @@ -0,0 +1,9 @@ +body { + background-color: rgba(49, 61, 55, 0.87); +} +h1 { + text-align: center; + margin: 150px; + font-size: 140px; + text-shadow: 2px -4px 16px rgb(186, 93, 240); +} diff --git a/index.html b/index.html index ede4147..468a05c 100644 --- a/index.html +++ b/index.html @@ -10,5 +10,7 @@

Hello Js!

+ + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..7ddc5af --- /dev/null +++ b/js/index.js @@ -0,0 +1,152 @@ +// // Основи Js (МАКСИМУМ) + +// // // 1. Задание +// // alert("What is the radius of the circle?"); +// // prompt(" Your version? "); +// // alert("Correct answer: " + "R = P : 2 * π"); + +// // // 2. Задание + +// // let distance = prompt( +// // "What is the distance in kilometers between the two cities ?" +// // ); +// // let time = prompt("How many hours he wants to get there ?"); + +// // alert( +// // " If you want to get there in " + +// // time + +// // " hours, we need to go an average of " + +// // distance / time + +// // " km per hour " +// // ); + +// // // 3. Задание + +// // let exDollar = 28.4; +// // ``; +// // let exEuro = 32.1; +// // let myPrice = prompt("Введите суму в долларах"); + +// // alert( +// // " Если ты хочешь поменять " + +// // myPrice + +// // ", ты получишь " + +// // (exDollar * myPrice) / exEuro + +// // " евро " +// // ); + +// // Типи Данних. МАКСИМУМ + +// // // 4. Задание +// // let result; //выплаченные проценты, +// // let moneyCount; //первоначальная сумма вложений, +// // let betYear = 5; //годовая ставка +// // let betDays = 60; //количество дней вклада, +// // let year = 365; //количество дней в году +// // let perCent = 100; + +// // moneyCount = prompt(`amount of money : `); +// // result = (moneyCount * betYear * betDays) / year / perCent; +// // alert(`You will receive this cash: ${result.toFixed(1)}`); + +// // // 5. Задание +// // let num = 2 && 0 && 3; +// // let num2 = 2 || 0 || 3; +// // let num3 = (2 && 0) || 3; +// // console.log(num); +// // console.log(num2); +// // console.log(num3); + +// // Homework Functions + +// // Задача 1 +// /* + +// Перше непарне число(в Кубі) + наступне непарне число(в кубі), +// алгоритм повторюється поки сума не перевищить ПЕРЕДАНЕ ЧИСЛО. + +// */ + +// let checkNum = (num) => { +// let previousSum = 0; +// let currentNum = 1; +// let isPerfect = false; +// if (num === 6) { +// return true; +// } + +// // let firstNum = previousNum * previousNum * previousNum; // =1 +// // let currentNum = previousNum + 2; +// // let secondNum = currentNum * currentNum * currentNum; //=3 +// // let finalNum = firstNum + secondNum; + +// while (previousSum < num) { +// let qybresult = currentNum * currentNum * currentNum; // =1 +// // console.log(qybresult); +// currentNum = currentNum + 2; +// // console.log(currentNum); +// previousSum = previousSum + qybresult; // 1 +// // console.log(previousSum); +// isPerfect = num === previousSum; +// } +// // console.log(isPerfect); +// return isPerfect; +// }; + +// // console.log(checkNum(6)); + +// // Задача 2 +// // let counter = 0; +// // setInterval(function () { +// // console.log(++counter); +// // }); + +// //Напиши функцію, яка приймає мінімальне і максимальне значення для діапазону, +// // і виводить тільки ті числа з діапазону, які є досконалими. + +// let cross = (min, max) => { +// for (let currentValue = min; currentValue < max; currentValue++) { +// let result = checkNum(currentValue); +// if (result) { +// console.log(currentValue); +// } +// } +// }; + +// // console.log(cross(0, 755)); + +// let spusok = [{ +// name: `milk`, +// count: 1, +// buy: true, +// price: 2, +// }, + +// name: `cake`, +// count: 2, +// buy: false, +// price: 5, +// }, +// { +// name: `bear`, +// count: 5, +// buy: true, +// price: 1, }, + +// { +// name: `bread`, +// count: 1, +// buy: false, +// price: 2, }, + +// { +// name: `ice-cream`, +// count: 1, +// buy: true, +// price: 4, },] + +// let sortProducts = (list) => { + +// let sorted = list.sort(`milk`, ``) + +// } diff --git a/js/massiv.js b/js/massiv.js new file mode 100644 index 0000000..1bc7307 --- /dev/null +++ b/js/massiv.js @@ -0,0 +1,71 @@ +const products = [ + { + name: `milk`, + buy: false, + price: 2, + count: 1, + }, + { + name: `bread`, + buy: false, + price: 1, + count: 1, + }, + { + name: `cheese`, + buy: true, + price: 4, + count: 2, + }, + { + name: `water`, + buy: false, + price: 1, + count: 4, + }, + { + name: `pineapples`, + buy: true, + price: 3, + count: 1, + }, +]; + +const sortProducts = (list) => { + const sorted = list.sort( + (productOne, productTwo) => productTwo.buy - productOne.buy + ); + return sorted; +}; +console.log(sortProducts(products)); + +function addScores(totalCount, product) { + return totalCount + product.count; +} + +function addPrices(totalPrice, product) { + if (product.buy) { + return totalPrice; + } + return totalPrice + product.price; +} +console.log(addPrices); + +const scoresTotal = products.reduce(addScores, 0); +console.log(scoresTotal); + +const priceTotal = products.reduce(addPrices, 0); +console.log(priceTotal); + +function sortByType(list, down) { + const sorted = list.sort((productOne, productTwo) => { + if (!down) { + return productTwo.price - productOne.price; + } else { + return productOne.price - productTwo.price; + } + }); + return sorted; +} +console.log(sortByType(products)); +console.log(sortByType(products, true)); diff --git a/js/object.js b/js/object.js new file mode 100644 index 0000000..811224f --- /dev/null +++ b/js/object.js @@ -0,0 +1,55 @@ +// // const Exmpl = { +// // chuselnuk: 3, +// // znamennuk: 7, +// // }; + +// const methods = { +// adding: (drib, dribTwo) => { +// let addOperation_1 = drib.chuselnuk * dribTwo.znamennuk; // 7*5 +// let addOperation_2 = dribTwo.chuselnuk * drib.znamennuk; // 5*7 +// let generalChs = addOperation_1 + addOperation_2; +// let generalZn = drib.znamennuk * dribTwo.znamennuk; // 7*9 + +// const resultObj = { +// znamennuk: generalZn, +// chuselnuk: generalChs, +// }; +// return resultObj; +// }, + +// subtraction: (drib, dribTwo) => { +// let addOperation_1 = drib.chuselnuk * dribTwo.znamennuk; // 7*5 +// let addOperation_2 = dribTwo.chuselnuk * drib.znamennuk; // 5*7 +// let generalChs = addOperation_1 - addOperation_2; +// let generalZn = drib.znamennuk * dribTwo.znamennuk; // 7*9 + +// const resultObj = { +// znamennuk: generalZn, +// chuselnuk: generalChs, +// }; +// return resultObj; +// }, + +// division: (drib, dribTwo) => { +// let generalChs = drib.chuselnuk * dribTwo.znamennuk; +// let generalZn = drib.znamennuk * dribTwo.chuselnuk; + +// const resultObj = { +// znamennuk: generalZn, +// chuselnuk: generalChs, +// }; +// return resultObj; +// }, +// }; +// console.log( +// methods.division( +// { +// chuselnuk: 3, +// znamennuk: 7, +// }, +// { +// chuselnuk: 5, +// znamennuk: 9, +// } +// ) +// );