You think you know Javascript?

If you have the skills to master the language, then take the challenge and see by yourself.

Attention

The content in the questionnaire is a semblance of the chapters inside the book series "You Don't Know Javascript" by Kyle Simpson. I strongly recommend you to take a look at his books and support his project or visit his workshops video training courses.

01. Back to the basics

Let me give you a hint...

Programs are just collections of many such statements, which together describe all the steps that it takes to perform your program's purpose.

In Javascript it might looks as follows:

a = b * 2

02. Variables

Javascript allows a variable to hold any type of value at any time. How can you call that?

Let me give you a hint...

Variables in Javascript can hold values of any type without any type of enforcement.

Consider this simple program:

var amount = 99.99; amount = amount * 2; console.log('amount'); // 199.98

03. Conditionals

In Javascript, Conditionals exist in other forms besides the if statement.

Let me give you a hint...

statement first evaluates its expression. It then looks for the first case clause whose expression evaluates to the same value as the result of the input expression (using the strict comparison, ===) and transfers control to that clause, executing the associated statements.

This is an example of a single operation:

switch (expr) { case 'Oranges': console.log('Lb $0.59.'); break; case 'Apples': console.log('Lb $0.32.'); break; default: console.log(expr); }

04. Values & Types - A

What result returns the typeof operator when examines the value of a = null;?

Let me give you a hint...

JavaScript provides a typeof operator that can examine a value and tell you what type it is.

Consider this simple program:

var a; typeof a; // "undefined" a = "hello world"; typeof a; // "string" a = 42; typeof a; // "number" a = true; typeof a; // "boolean"

05. Comparing values

There are two main types of value comparison that you will need to make in your JS programs:

Let me give you a hint...

A non-boolean value only follows this "truthy"/"falsy" coercion if it's actually coerced to a boolean.

This is an example of a single operation:

var a = "42"; var b = 42; a == b; // true a === b; // false

06. Values & Types - B

It's the reference of a compound value where you can set properties (named locations) that each hold their own values of any type.

You may need this...

Properties can either be accessed with dot notation (i.e., obj.a) or bracket notation (i.e., obj["a"]). Dot notation is shorter and generally easier to read, and is thus preferred when possible.

Consider this simple program:

obj.a; obj.b; obj.c;

07. Built-In Type Methods

The built-in types and subtypes have behaviors exposed as properties and methods that are quite powerful and useful. What's the result generated by the length method in the example ?

var a = "hello world"; a.length;

Nah! You don't need hints.

08. Coercion - A

If the Implicit Coercion is when the type conversion can happen as more of a non-obvious side effect of some other operation. What type of coercion is in the example code?

var a = "42"; var b = Number( a ); a; // "42" b; // 42 -- the number!

Nah! You don't need hints.

09. Coercion - A

If the Explicit Coercion is simply that you can see obviously from the code that a conversion from one type to another will occur. What type of coercion is in the example code?

var a = "42"; var b = a * 1; a; // "42" b; // 42

Nah! You don't need hints.

The Creator

Who created the JS language?

Nah! You don't need hints.

Total achieved

Attention

The content in the questionnaire is a semblance of the chapters inside the book series "You Don't Know Javascript" by Kyle Simpson. I strongly recommend you to take a look at his books and support his project or visit his workshops video training courses.