You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1174,11 +1197,13 @@ const square = n => n * n; // -> 4
1174
1197
13. Write a function called *isPrime*, which checks if a number is prime number.
1175
1198
14. Write a functions which checks if all items are unique in the array.
1176
1199
15. Write a function which checks if all the itmes of the array are the same data type.
1200
+
1. JavaScript variable name does not support special characters or symbols execpt $ or _. Write a function ***isValidVariable** which check if a variable is valid or invlaid variable.
1177
1201
16. Write a function which returns array of seven random numbers in a range of 0-9. All the numbers must be unique.
1178
1202
```js
1179
1203
sevenRandomNumbers()[(1, 4, 5, 7, 9, 8, 0)];
1180
1204
```
1181
1205
1206
+
1182
1207
## Object
1183
1208
1184
1209
Everything can be an object and objects do have properties and properties have values.
let {width:w, heigh:h, area:a, perimeter:p} = rectangle;
1602
-
console.log(w, h, a, p) //20, 10, 200, undefined
1633
+
console.log(w, h, a, p) //20 10 200 undefined
1634
+
1635
+
```
1636
+
If the key is not found in the object the variable will be assinged to undefined. In case, the key is not in the object we can give a default value during declaration. See the example.
1637
+
```js
1638
+
constrectangle= {
1639
+
width:20,
1640
+
height:10,
1641
+
area:200
1642
+
}
1643
+
let {width, heigh, area, perimeter =60} = rectangle;
return`${firstName}${lastName} lives in ${country}. He is ${age} years old. He is an ${job}. He teaches ${formattedSkills} and ${skills[skills.length-1]}. He speakes ${formattedLanguages} and a little bit of ${languages[2]}.`;
1725
+
};
1726
+
console.log(getPersonInfo(person))
1727
+
/*
1728
+
Asabeneh Yetayeh lives in Finland. He is 200 years old. He is an Instructor and Developer. He teaches HTML, CSS, JavaScript, React, Redux, Node, MongoDB, Python and D3.js. He speakes Amharic, English and a little bit of Suomi(Finnish)
1. Assign the elements of constants array to e, pi, gravity, humanBodyTemp, waterBoilingTemp.
1747
+
2. Assign the elements of countries array to fin, est, sw, den, nor
1748
+
3. Destructure the rectangle object by its propertis or keys.
1607
1749
1608
1750
## Document Object Model
1609
1751
HTML document is structured as a JavaScript Object. Every HTML element has a different properties which can help to manipulate it. It is possible to get, create, append or remove HTML elements using JavaScript. Check the examples below. Selecting HTML element using JavaScript is similar to select CSS. To select an HTML element, we use tag name, id, class name. To create an HTML element we use tag name.
0 commit comments