@@ -243,16 +243,15 @@
}
]
let str = "<table border='1' cols = 4>"
- for (let i = 0; i < 4; i++) {
- for (let key in persons[i]) {
- str += `<tr><td>${key}</td><td>${persons[i][key]}</td></tr>`
+ arraypersons.map (persons => {
+ str += `<tr>`
+ Object.values(persons).map(value => str += `<td>${value}</td>`)
+ str += `</tr>`
-
- }
- }str += "</table>"
- console.log(str)
+ })
+ str += "</table>"
document.write(str)
+
//HTML tr color
let persons = [
a = {
@@ -285,9 +284,9 @@
for (let key in persons[i]) {
str += `<tr style = "color: green; ><td>${key}</td><td>${persons[i][key]}</td></tr>`
+ } str += "</table>"
console.log(str)
@@ -320,7 +319,9 @@
//destruct 3
let number = [1, 2, 3, 4, 5, 6, 7, 10];
- let [a, b, { length = number.length }] = number
+ let [a, b] = arr;
+ let [...length] = arr;
+ [a,b, ...length]