JS

Logic Trainer Beta

Practice JavaScript execution mental models

0
0%
0
Level 1 Variables Predict Output

Predict the output

Read the JavaScript code below carefully and select what will be logged to the console.

Explanation after each answer

Topic Practice

Quick JavaScript Notes

.filter()

Returns a new array of elements where callback returned truthy. Never modifies original.

.map()

Transforms every item into a new array of exact same length.

=== vs ==

Prefer === when you do not intentionally want coercion. == follows coercion rules before comparison.

0-based Indexes

First item is at [0]. Last item is at [arr.length - 1].

Review Recent Questions

Revisit previously answered or missed questions to solidify your intuition.

JavaScript examples are small, local learning exercises. Outputs refer to modern ECMAScript behavior represented by these snippets; real applications can differ by surrounding code and environment.