Question from the Javascript test

Write a Javascript code that will display the letters A, B, C, D in the console.

Medium

What will the following code display?

var funcs={
    A : function() { console.log('A') },
    B : function() { console.log('B') },
    C : function() { console.log('C') },
    D : function() { console.log('D') }
};

['A', 'B', 'C', 'D'].forEach(function(letter, index) {
  setTimeout(funcs[letter], index* 10);
});
Author: Jean-marie CléryStatus: PublishedQuestion passed 2113 times
Edit
3
Community EvaluationsNo one has reviewed this question yet, be the first!