JavaScript - 23/10/2017 19:57 EDT
$8-15 USD / hour
1) How would you iterate over a collection of objects in Javascript using a “for” clause { ‘A’:100, ‘X’:200, ‘Pete’:null, ‘George’:500 }.
2) Write a utility function that takes a string of text and a callback function. It would create a <td> element with the text as it’s body, execute the callback passing the td element (for example to have the callback do some style operations) and then return the modified td element.
function test(txt, callback) {
var td = null; // <- make a td element
// execute the callback, passing it the td element
return td;
}
3) How could you modify the function to return null if the callback returned a Boolean false. Note… no return should be interpreted as true.
Project ID: #15469752