diff --git a/Untitled-1.js b/Untitled-1.js new file mode 100644 index 0000000..ee41955 --- /dev/null +++ b/Untitled-1.js @@ -0,0 +1,4 @@ +const b = {qwe: 123, qw: 456}; +const c = b + +console.log(c) \ No newline at end of file diff --git a/Week1/QA dir.js b/Week1/QA dir.js new file mode 100644 index 0000000..3a61b8b --- /dev/null +++ b/Week1/QA dir.js @@ -0,0 +1,10 @@ +let banana = {} +const fruits= [] +banana.fruit = true; + +fruits.push(banana) +console.log(fruits); + + +banana = {fruit: true, color: 'yellow'}; +console.log(banana); diff --git a/Week1/practice-exercises/1-remove-the-comma.js b/Week1/practice-exercises/1-remove-the-comma.js index b71cffd..fba26b7 100644 --- a/Week1/practice-exercises/1-remove-the-comma.js +++ b/Week1/practice-exercises/1-remove-the-comma.js @@ -6,7 +6,8 @@ */ let myString = 'hello,this,is,a,difficult,to,read,sentence'; - +myString = myString.replace(/,/g, ' '); // Replace all commas with spaces +console.log(myString); // Log the modified string to the console /* --- Code that will test your solution, do NOT change. Write above this line --- */ diff --git a/Week1/practice-exercises/2-even-odd-reporter.js b/Week1/practice-exercises/2-even-odd-reporter.js index 6edf23e..886ba40 100644 --- a/Week1/practice-exercises/2-even-odd-reporter.js +++ b/Week1/practice-exercises/2-even-odd-reporter.js @@ -7,3 +7,12 @@ * If it's even, log to the console The number [PUT_NUMBER_HERE] is even!. */ +let num = 0; +while (num <= 20) { + if (num % 2 == 0) { + console.log(`The number ${num} is even!`); + } else { + console.log(`The number ${num} is odd!`); + }; + num ++ ; +} \ No newline at end of file diff --git a/Week1/practice-exercises/3-recipe-card.js b/Week1/practice-exercises/3-recipe-card.js index 24bcb54..40ad597 100644 --- a/Week1/practice-exercises/3-recipe-card.js +++ b/Week1/practice-exercises/3-recipe-card.js @@ -12,3 +12,27 @@ * Ingredients: 4 eggs, 2 strips of bacon, 1 tsp salt/pepper */ +const recipe = {}; + +recipe.name = "Omelette"; +recipe.serves = 2; +recipe.ingredients = ["4 eggs", "2 strips of bacon", "1 tsp salt/pepper"]; + +for (let i in recipe){ + + // good but more difficult code below + /*let value = Array.isArray(recipe[i]) ? recipe[i].join(", ") : recipe[i];*/ + + let value; // create a variable to store the property value + if (Array.isArray(recipe[i])) { // check if the value is an array + value = recipe[i].join(", "); // if it's an array, join all elements with a comma + } + else { // if it's not an array, just keep the value as it is + value = recipe[i]; + } + + //optional head letter ///// .charAt(0) - RETURNS JUST ONE SIGN + let head = i.charAt(0).toUpperCase() + i.slice(1); + + console.log(head + ": " + value); +} diff --git a/Week1/practice-exercises/4-reading-list.js b/Week1/practice-exercises/4-reading-list.js index f535657..6d79c13 100644 --- a/Week1/practice-exercises/4-reading-list.js +++ b/Week1/practice-exercises/4-reading-list.js @@ -9,3 +9,31 @@ * If you haven't read it log a string like You still need to read "The Lord of the Rings" */ +let bookList = [ + { + title: "The Hobbit", + author: "J.R.R. Tolkien", + alreadyRead: true + }, + { + title: "Harry Potter", + author: "J.K. Rowling", + alreadyRead: true + }, + { + title: "Tales of Demons and Gods", + author: "Mad Snail", + alreadyRead: false + } +]; + +for (i in bookList) { + let book = bookList[i]; + console.log(`${book.title} by ${book.author}`); + + if (book.alreadyRead) { + console.log(`You already read "${book.title}"`); + } else { + console.log(`You still need to read "${book.title}"`); + } +} \ No newline at end of file diff --git a/Week1/practice-exercises/5-who-wants-a-drink.js b/Week1/practice-exercises/5-who-wants-a-drink.js index f37f02b..aa3e73b 100644 --- a/Week1/practice-exercises/5-who-wants-a-drink.js +++ b/Week1/practice-exercises/5-who-wants-a-drink.js @@ -8,4 +8,32 @@ */ // There are 3 different types of drinks: -const drinkTypes = ['cola', 'lemonade', 'water']; \ No newline at end of file +const drinkTypes = ['cola', 'lemonade', 'water']; + +const drinkTray = []; + +//counter for do - while loop +let counter = { + 'cola': 0, + 'lemonade': 0, + 'water': 0 +} + +//loop according task +for (let i = 0; i < 5; i++) { + let randomItem; + + //take 1 random drink + do { + let randomIndex = Math.floor(Math.random() * drinkTypes.length); + randomItem = drinkTypes[randomIndex]; + + // 2 item max + } while (counter[randomItem] >= 2); + + drinkTray.push(randomItem); + + counter[randomItem] ++ ; +} + +console.log(`Hey guys, I brought a ${drinkTray.join(', ')}!`); \ No newline at end of file diff --git a/Week1/prep-exercises/1-traffic-light/traffic-light-1.js b/Week1/prep-exercises/1-traffic-light/traffic-light-1.js index f1d9169..008fb59 100644 --- a/Week1/prep-exercises/1-traffic-light/traffic-light-1.js +++ b/Week1/prep-exercises/1-traffic-light/traffic-light-1.js @@ -12,6 +12,15 @@ while (rotations < 2) { const currentState = trafficLight.state; console.log("The traffic light is on", currentState); + if (currentState == "green") { + trafficLight.state = "orange"; + } else if (currentState == "orange") { + trafficLight.state = "red"; + } else if (currentState == "red") { + rotations += 1; + trafficLight.state = "green"; + } + // TODO // if the color is green, turn it orange // if the color is orange, turn it red diff --git a/Week1/prep-exercises/1-traffic-light/traffic-light-2.js b/Week1/prep-exercises/1-traffic-light/traffic-light-2.js index 8c6ba95..583e48c 100644 --- a/Week1/prep-exercises/1-traffic-light/traffic-light-2.js +++ b/Week1/prep-exercises/1-traffic-light/traffic-light-2.js @@ -14,6 +14,14 @@ while (cycle < 2) { const currentState = trafficLight.possibleStates[trafficLight.stateIndex]; console.log("The traffic light is on", currentState); + // Update the stateIndex to the next state + trafficLight.stateIndex = (trafficLight.stateIndex + 1) % trafficLight.possibleStates.length; + + if (currentState == 'red') { + cycle ++ ; // Increment cycle only when the light is red + } + + // TODO // if the color is green, turn it orange // if the color is orange, turn it red diff --git a/Week2/prep-exercises/1-traffic-light/traffic-light.js b/Week2/prep-exercises/1-traffic-light/traffic-light.js index f4a5c1a..f3951ed 100644 --- a/Week2/prep-exercises/1-traffic-light/traffic-light.js +++ b/Week2/prep-exercises/1-traffic-light/traffic-light.js @@ -9,14 +9,25 @@ function getCurrentState(trafficLight) { // TODO // Should return the current state (i.e. colour) of the `trafficLight` // object passed as a parameter. + return(trafficLight.possibleStates[trafficLight.stateIndex]) } function getNextStateIndex(trafficLight) { // TODO // Return the index of the next state of the `trafficLight` such that: // - if the color is green, it will turn to orange - // - if the color is orange, it will turn to red + // - if the color is orane, it will turn to red // - if the color is red, it will turn to green + if (trafficLight.stateIndex == 0){ + trafficLight.stateIndex += 1; + + } else if (trafficLight.stateIndex == 1){ + trafficLight.stateIndex += 1; + + } else if (trafficLight.stateIndex == 2){ + trafficLight.stateIndex = 0; + } + return(trafficLight.stateIndex) } // This function loops for the number of seconds specified by the `secs` diff --git a/Week2/prep-exercises/2-experiments/index.js b/Week2/prep-exercises/2-experiments/index.js index 7e5aa92..30cff77 100644 --- a/Week2/prep-exercises/2-experiments/index.js +++ b/Week2/prep-exercises/2-experiments/index.js @@ -13,6 +13,11 @@ function runExperiment(sampleSize) { // for keeping a count how many times the value 1 is thrown, the second // element for value 2, etc. + for (let i = 0; i < sampleSize; i++) { + let valueCount = Math.floor(Math.random() * 6) + 1; + valueCounts[valueCount - 1] += 1; + } + const results = []; // TODO @@ -25,6 +30,9 @@ function runExperiment(sampleSize) { // two decimals, e.g. '14.60'. // 3. Then push that string onto the `results` array. + for (let i of valueCounts){ + results.push ((i * 100 / sampleSize).toFixed(2)); //we ccan use push(Number()) if we need int + } return results; } @@ -41,6 +49,10 @@ function main() { // [ '26.00', '17.00', '10.00', '19.00', '16.00', '12.00' ] 100 // [ '14.60', '17.10', '19.30', '15.50', '16.70', '16.80' ] 1000 // [ '16.71', '16.68', '16.69', '16.66', '16.67', '16.59' ] 1000000 + + for (let sampleSize of sampleSizes){ + console.log(runExperiment(sampleSize), sampleSize) //call func runExperiment + } } -main(); +main(); \ No newline at end of file diff --git a/Week3/prep-exercises/1-hyf-program/1-find-mentors.js b/Week3/prep-exercises/1-hyf-program/1-find-mentors.js index 72baa61..1b711fc 100644 --- a/Week3/prep-exercises/1-hyf-program/1-find-mentors.js +++ b/Week3/prep-exercises/1-hyf-program/1-find-mentors.js @@ -1,26 +1,50 @@ import { modules, students, mentors, classes } from "./hyf.js"; -/** - * Tjebbe would like help to get a list of possible mentors for a module. - * Fill in this function that finds all the mentors that can teach the given module. - * - * It should return an array of names. So something like: - * ['John', 'Mary'] - */ +/* const possibleMentorsForModule = (moduleName) => { - // TODO complete this function + + + const teachers = []; + mentors.forEach((mentor) => { + if (mentor.canTeach.includes(moduleName)) { + teachers.push(mentor.name); + } + }); + return teachers; }; +*/ + + + //alternative solution +const possibleMentorsForModule = (moduleName) => + mentors + .filter(m => m.canTeach.includes(moduleName)) + .map(m => m.name); + + // You can uncomment out this line to try your function -// console.log(possibleMentorsForModule('using-apis')); - -/** - * Tjebbe wants to make it even easier for himself. - * Fill in this function that chooses a random mentor to teach the given module. - * - * It should return a single name. - */ +console.log(possibleMentorsForModule('using-apis')); + const findMentorForModule = (moduleName) => { - // TODO complete this function + + const theChosen = mentors // new array of names + .filter(m => m.canTeach.includes(moduleName)) // filtered by module + const index = Math.floor(Math.random() * theChosen.length); // randon index + return theChosen[index].name; // name with this index + + //alternative solution + + /*const teachers = []; + mentors.forEach((mentor) => { + if (mentor.canTeach.includes(moduleName)) { + teachers.push(mentor.name); + } + }); + const index = Math.floor(Math.random() * teachers.length); + const theChosen = teachers[index]; + + return theChosen; + */ }; // You can uncomment out this line to try your function -// console.log(findMentorForModule('javascript')); + console.log(findMentorForModule('javascript')); diff --git a/Week3/prep-exercises/1-hyf-program/2-class-list.js b/Week3/prep-exercises/1-hyf-program/2-class-list.js index 44d2798..0e97e44 100644 --- a/Week3/prep-exercises/1-hyf-program/2-class-list.js +++ b/Week3/prep-exercises/1-hyf-program/2-class-list.js @@ -1,36 +1,48 @@ import { modules, students, mentors, classes } from "./hyf.js"; -/** - * We would like to have a list of everyone that is currently participating in a class. - * This means the students, but also the mentors that are currently teaching the class. - * The students should be self explanatory, but to find the mentors you will need to follow these steps: - * - Check what the `currentModule` of the class is - * - Find the mentor(s) that are `nowTeaching` that module - * - * Should return the list of names and their roles. So something like: - * - * [{ name: 'John', role: 'student' }, { name: 'Mary', role: 'mentor' }] - */ const getPeopleOfClass = (className) => { - // TODO complete this function + + // нахожу через класс(массив) текущий модуль // find current module through classes + const moduleName = classes.find((c) => c.name === className).currentModule; + // console.log (moduleName); + + + const studentNames = students //find student's name + .filter(s => s.class === className) + .map(s => ({name: s.name, role: "student" })); + // console.log (studentNames); + + const teacherNames = mentors //find mentor's name + .filter(m => m.nowTeaching === moduleName) + .map(m => ({name: m.name, role: "mentor" })); + // console.log (teacherNames); + + if (studentNames.length === 0) studentNames.push({ name: "NO student", role: "student" }); + if (teacherNames.length === 0) teacherNames.push({ name: "No mentor", role: "mentor" }); + + return [...studentNames, ...teacherNames] + }; // You can uncomment out this line to try your function -// console.log(getPeopleOfClass('class34')); - -/** - * We would like to have a complete overview of the current active classes. - * First find the active classes, then for each get the people of that class. - * - * Should return an object with the class names as properties. - * Each class name property contains an array identical to the return from `getPeopleFromClass`. So something like: - * - * { - * class34: [{ name: 'John', role: 'student' }, { name: 'Mary', role: 'mentor' }], - * class35: [{ name: 'Jane', role: 'student' }, { name: 'Steve', role: 'mentor' }] - * } - */ +console.log(getPeopleOfClass('class34')); + const getActiveClasses = () => { - // TODO complete this function + const activeClasses = classes //make array of classes name + .filter(a => a.active) + .map(s => s.name); + // console.log (activeClasses); + + const finalAnswer = {} + for (let numberClass of activeClasses){ + finalAnswer[numberClass] = getPeopleOfClass(numberClass); + } + + return finalAnswer; +// console.log(activeMentors); + }; + + + // You can uncomment out this line to try your function -// console.log(getActiveClasses()); +console.log(getActiveClasses()); diff --git a/Week4/prep-exercises/1-wallet/ex2-classes.js b/Week4/prep-exercises/1-wallet/ex2-classes.js index f016137..b3d9d4c 100644 --- a/Week4/prep-exercises/1-wallet/ex2-classes.js +++ b/Week4/prep-exercises/1-wallet/ex2-classes.js @@ -3,16 +3,21 @@ import eurosFormatter from './euroFormatter.js'; class Wallet { #name; #cash; + #dailyAllowance; + #dayTotalWithdrawals; - constructor(name, cash) { + + constructor(name, cash = 0, dailyAllowance = 40) { this.#name = name; - this.#cash = cash; + this.#cash = cash; + this.#dailyAllowance = dailyAllowance; + this.#dayTotalWithdrawals = 0; } get name() { return this.#name; } - + deposit(amount) { this.#cash += amount; } @@ -23,7 +28,13 @@ class Wallet { return 0; } + if (this.#dayTotalWithdrawals + amount > this.#dailyAllowance) { + console.log(`Insufficient remaining daily allowance!`); + return 0; + } + this.#cash -= amount; + this.#dayTotalWithdrawals += amount; return amount; } @@ -37,6 +48,17 @@ class Wallet { wallet.deposit(withdrawnAmount); } + setDailyAllowance(newAllowance){ + this.#dailyAllowance = newAllowance; + console.log( + `Daily allowance set to: ${eurosFormatter.format(newAllowance)}` + ); + } + + resetDailyAllowance(){ + this.#dayTotalWithdrawals = 0; + }; + reportBalance() { console.log( `Name: ${this.name}, balance: ${eurosFormatter.format(this.#cash)}` @@ -58,6 +80,9 @@ function main() { walletJack.reportBalance(); walletJoe.reportBalance(); walletJane.reportBalance(); + + walletJack.setDailyAllowance(100); // limit change + walletJack.withdraw(50); // test limit change } main(); diff --git a/Week4/prep-exercises/1-wallet/ex3-object.js b/Week4/prep-exercises/1-wallet/ex3-object.js index e94faac..212fb3b 100644 --- a/Week4/prep-exercises/1-wallet/ex3-object.js +++ b/Week4/prep-exercises/1-wallet/ex3-object.js @@ -1,9 +1,11 @@ import eurosFormatter from './euroFormatter.js'; -function createWallet(name, cash = 0) { +function createWallet(name, cash = 0, dailyAllowance = 40) { return { _name: name, _cash: cash, + _dailyAllowance: dailyAllowance, + _dayTotalWithdrawals: 0, deposit: function (amount) { this._cash += amount; @@ -15,7 +17,13 @@ function createWallet(name, cash = 0) { return 0; } + if (this._dayTotalWithdrawals + amount > this._dailyAllowance) { + console.log(`Insufficient remaining daily allowance!`); + return 0; + } + this._cash -= amount; + this._dayTotalWithdrawals += amount; return amount; }, @@ -29,12 +37,24 @@ function createWallet(name, cash = 0) { wallet.deposit(withdrawnAmount); }, + + setDailyAllowance(newAllowance){ + this._dailyAllowance = newAllowance; + console.log( + `Daily allowance set to: ${eurosFormatter.format(newAllowance)}` + ); + }, + reportBalance: function () { console.log( `Name: ${this._name}, balance: ${eurosFormatter.format(this._cash)}` ); }, + resetDailyAllowance(){ + this._dayTotalWithdrawals = 0; + }, + getName: function () { return this._name; }, @@ -55,6 +75,8 @@ function main() { walletJack.reportBalance(); walletJoe.reportBalance(); walletJane.reportBalance(); + walletJack.setDailyAllowance(100); // limit change + walletJack.withdraw(50); // test limit change } main(); diff --git a/Week4/prep-exercises/1-wallet/ex4-object-shared-methods.js b/Week4/prep-exercises/1-wallet/ex4-object-shared-methods.js index bd4fd20..cec38d2 100644 --- a/Week4/prep-exercises/1-wallet/ex4-object-shared-methods.js +++ b/Week4/prep-exercises/1-wallet/ex4-object-shared-methods.js @@ -10,7 +10,13 @@ function withdraw(amount) { return 0; } + if (this._dayTotalWithdrawals + amount > this._dailyAllowance) { + console.log(`Insufficient remaining daily allowance!`); + return 0; + } + this._cash -= amount; + this._dayTotalWithdrawals += amount; return amount; } @@ -24,6 +30,17 @@ function transferInto(wallet, amount) { wallet.deposit(withdrawnAmount); } +function setDailyAllowance(newAllowance){ + this._dailyAllowance = newAllowance; + console.log( + `Daily allowance set to: ${eurosFormatter.format(newAllowance)}` + ); +} + +function resetDailyAllowance(){ + this._dayTotalWithdrawals = 0; +} + function reportBalance() { console.log( `Name: ${this._name}, balance: ${eurosFormatter.format(this._cash)}` @@ -34,7 +51,7 @@ function getName() { return this._name; } -function createWallet(name, cash = 0) { +function createWallet(name, cash = 0, dailyAllowance = 40) { return { _name: name, _cash: cash, @@ -43,6 +60,11 @@ function createWallet(name, cash = 0) { transferInto, reportBalance, getName, + _dayTotalWithdrawals: 0, + _dailyAllowance: dailyAllowance, + resetDailyAllowance, + setDailyAllowance, + }; } @@ -60,6 +82,8 @@ function main() { walletJack.reportBalance(); walletJoe.reportBalance(); walletJane.reportBalance(); + walletJack.setDailyAllowance(100); // limit change + walletJack.withdraw(50); // test limit change } main(); diff --git a/Week4/prep-exercises/1-wallet/ex5-prototype.js b/Week4/prep-exercises/1-wallet/ex5-prototype.js index 7cba410..2d7adc2 100644 --- a/Week4/prep-exercises/1-wallet/ex5-prototype.js +++ b/Week4/prep-exercises/1-wallet/ex5-prototype.js @@ -1,8 +1,10 @@ import eurosFormatter from './euroFormatter.js'; -function Wallet(name, cash) { +function Wallet(name, cash = 0, dailyAllowance = 40) { this._name = name; this._cash = cash; + this._dayTotalWithdrawals = 0; + this._dailyAllowance = dailyAllowance; } Wallet.prototype.deposit = function (amount) { @@ -15,7 +17,13 @@ Wallet.prototype.withdraw = function (amount) { return 0; } + if (this._dayTotalWithdrawals + amount > this._dailyAllowance) { + console.log(`Insufficient remaining daily allowance!`); + return 0; + } + this._cash -= amount; + this._dayTotalWithdrawals += amount; return amount; }; @@ -29,6 +37,20 @@ Wallet.prototype.transferInto = function (wallet, amount) { wallet.deposit(withdrawnAmount); }; + + +Wallet.prototype.setDailyAllowance = function (newAllowance) { + this._dailyAllowance = newAllowance; + console.log( + `Daily allowance set to: ${eurosFormatter.format(newAllowance)}` + ); +}; + +Wallet.prototype.resetDailyAllowance = function () { + this._dayTotalWithdrawals = 0; +}; + + Wallet.prototype.reportBalance = function () { console.log( `Name: ${this._name}, balance: ${eurosFormatter.format(this._cash)}` diff --git a/Week4/prep-exercises/2-game-of-life/Cell.js b/Week4/prep-exercises/2-game-of-life/Cell.js index cac08da..0da4ea6 100644 --- a/Week4/prep-exercises/2-game-of-life/Cell.js +++ b/Week4/prep-exercises/2-game-of-life/Cell.js @@ -14,6 +14,12 @@ export default class Cell { this.y = y; this.alive = Math.random() > 0.5; this.nextAlive = false; + if (this.alive){ + this.liveTime = 1; + } else { + this.liveTime = 0; + } + this.opacity = 0.25; } draw(context) { @@ -26,9 +32,19 @@ export default class Cell { Cell.size ); + if (this.liveTime === 1){ + this.opacity = 0.25; + } else if (this.liveTime === 2){ + this.opacity = 0.5; + } else if (this.liveTime === 3){ + this.opacity = 0.75; + } else if (this.liveTime > 3){ + this.opacity = 1; + } + if (this.alive) { // Draw living this inside background - context.fillStyle = `rgb(24, 215, 236)`; + context.fillStyle = `rgba(24, 215, 236, ${this.opacity})`; context.fillRect( this.x * Cell.size + 1, this.y * Cell.size + 1, @@ -49,6 +65,12 @@ export default class Cell { // Living cell dies, dead cell remains dead this.nextAlive = false; } + + if (this.alive){ + this.liveTime ++ ; + } else { + this.liveTime = 0; + } } update() { diff --git a/random.js b/random.js new file mode 100644 index 0000000..cc58b9d --- /dev/null +++ b/random.js @@ -0,0 +1,7 @@ +const basket2 = { + fruit: "banana", + printFruit:() => { + console.log(this.fruit); + } +}; +basket2.printFruit(); // undefined \ No newline at end of file diff --git "a/\320\277\320\276\321\217\320\274\320\275\320\270\321\202\321\214 3.js" "b/\320\277\320\276\321\217\320\274\320\275\320\270\321\202\321\214 3.js" new file mode 100644 index 0000000..19f49eb --- /dev/null +++ "b/\320\277\320\276\321\217\320\274\320\275\320\270\321\202\321\214 3.js" @@ -0,0 +1,3 @@ +const banaan = {ding: true, nietDing: false}; +console.log('dfdfdf' + banaan); +console.log(`asdasd ${banaan}`) \ No newline at end of file diff --git "a/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 1.js" "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 1.js" new file mode 100644 index 0000000..e1845a4 --- /dev/null +++ "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 1.js" @@ -0,0 +1,8 @@ +const basket2 = { + fruit: "banana", + printFruit:() => { + console.log(this.fruit); + } +}; +basket2.printFruit(); // undefined + diff --git "a/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 2.js" "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 2.js" new file mode 100644 index 0000000..1bd1a9e --- /dev/null +++ "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214 2.js" @@ -0,0 +1,6 @@ +function showFruit(){ + console.log(this.fruit); +} +showFruit(); // undefined, because this is window object and there is no fruit property +const orangeBasket = {fruit: "orange"}; +showFruit.call(orangeBasket); // "orange" \ No newline at end of file diff --git "a/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214\321\201.js" "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214\321\201.js" new file mode 100644 index 0000000..b8cd9a6 --- /dev/null +++ "b/\320\277\320\276\321\217\321\201\320\275\320\270\321\202\321\214\321\201.js" @@ -0,0 +1,4 @@ +const y = {hair: "black", eyes: "brown"}; +const {hair, eyes} = y; +console.log(hair, eyes); // "black" +const {hair: h, eyes: e} = y; \ No newline at end of file