xxxxxxxxxx
function findLongestWordLength(str) {
return Math.max(str.split(" ").map(word => word.length))
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
xxxxxxxxxx
const object = {'a': 1, 'b': 2, 'c' : 3};
for (const [key, value] of Object.entries(object)) {
console.log(key, value);
}
xxxxxxxxxx
var myMap = new Map();
myMap.set("0", "foo");
myMap.set(1, "bar");
myMap.set({}, "baz");
for (const [key, value] of Object.entries(myMap)) {
console.log(key, value);
}
xxxxxxxxxx
Map<String, String> map =
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey() + "/" + entry.getValue());
}
xxxxxxxxxx
showDetails(cards, id){
cards.map(function(card, index){
if(card.id==id){
console.log(card);
return card;
}
})
}