Update Chapter 3 Exercises
This commit is contained in:
+8
-5
@@ -20,12 +20,13 @@ console.log(finalList.lastIndexOf('Pop'));
|
|||||||
console.log(finalList);
|
console.log(finalList);
|
||||||
|
|
||||||
Exercise 3
|
Exercise 3
|
||||||
const myArr = [1,2,3];
|
const myArr = [1, 2, 3];
|
||||||
const bigArr = [myArr,myArr,myArr];
|
const bigArr = [myArr, myArr, myArr];
|
||||||
|
console.log(bigArr[0][1]);
|
||||||
console.log(bigArr[1][1]);
|
console.log(bigArr[1][1]);
|
||||||
|
console.log(bigArr[2][1]);
|
||||||
console.log(bigArr);
|
console.log(bigArr);
|
||||||
|
|
||||||
|
|
||||||
Exercise 4
|
Exercise 4
|
||||||
const myCar = {
|
const myCar = {
|
||||||
make: 'Toyota',
|
make: 'Toyota',
|
||||||
@@ -35,10 +36,12 @@ const myCar = {
|
|||||||
color: 'blue',
|
color: 'blue',
|
||||||
forSale: false
|
forSale: false
|
||||||
};
|
};
|
||||||
const propColor = 'color';
|
let propColor = 'color';
|
||||||
|
|
||||||
myCar[propColor] = 'red';
|
myCar[propColor] = 'red';
|
||||||
|
propColor = 'forSale';
|
||||||
|
myCar[propColor] = true;
|
||||||
console.log(myCar.make + ' ' + myCar.model);
|
console.log(myCar.make + ' ' + myCar.model);
|
||||||
|
console.log(myCar.forSale);
|
||||||
|
|
||||||
Exercise 5
|
Exercise 5
|
||||||
const people = {friends:[]};
|
const people = {friends:[]};
|
||||||
|
|||||||
Reference in New Issue
Block a user