Array
divers exemples
MAP
Map
Reduce
reduce
DOM
Avancé : promise
Array.From
from
MAX DES COLONNES
JS Bin on jsbin.com
let t = T[0].map( (_,col)=> T.map( (lig,_)=>lig[col]).reduce(function(a, b) {
return Math.max(a,b);
})
);
JS Bin on jsbin.com
let t = T[0].map( (_,col)=> T.map( (lig,_)=>lig[col]).reduce(function(a, b) {
return Math.max(a,b);
})
);
JS Bin on jsbin.com
map et destructuring !
const article = [
["title", 'Hello Template Literals'],
["teaser", 'String interpolation is awesome. Here are some features'],
["body", 'Lots and lots of sanitized HTML'],
["tags", ['es6', 'template-literals', 'es6-in-depth']]
]
let [title,teaser,body,tags] = article;
let html = `<article>
<header>
<h1>${title[1]}</h1>
</header>
<section>
<div>${teaser[1]}</div>
<div>${body[1]}</div>
</section>
<footer>
<ul>
${tags[1].map(tag => `<li>${tag}</li>`).join('')}
</ul>
</footer>
</article>`
document.body.innerHTML= (`${html}`);
["title", 'Hello Template Literals'],
["teaser", 'String interpolation is awesome. Here are some features'],
["body", 'Lots and lots of sanitized HTML'],
["tags", ['es6', 'template-literals', 'es6-in-depth']]
]
let [title,teaser,body,tags] = article;
let html = `<article>
<header>
<h1>${title[1]}</h1>
</header>
<section>
<div>${teaser[1]}</div>
<div>${body[1]}</div>
</section>
<footer>
<ul>
${tags[1].map(tag => `<li>${tag}</li>`).join('')}
</ul>
</footer>
</article>`
document.body.innerHTML= (`${html}`);
Obkect Keys en action
const villeHabitants = {Marseille:1000000,
Avignon:50000,
alancon:23000,
grenoble:110000,
lyon:450000,
Paris:2700000};
Trouvez la somme des habitants des villes dont les lettres commencent par [a-l]
Avignon:50000,
alancon:23000,
grenoble:110000,
lyon:450000,
Paris:2700000};
Trouvez la somme des habitants des villes dont les lettres commencent par [a-l]
Inscription à :
Articles (Atom)