JavaScript Exercises

Fill in the blanks to test your knowledge.

1

Declare a constant variable called name

name = "DevForge";
2

Print "Hello" to the console

console.("Hello");
3

Use an arrow function to add two numbers

const add = (a, b) a + b;
4

Get the length of an array

const len = myArray.;
5

Add an item to the end of an array

arr.(newItem);
6

Use strict equality comparison

if (a b) { ... }
7

Convert a string to an integer

const num = ("42");
8

Check if an array contains a value

arr.("value")
9

Create a template literal

const msg = Hello, ${name}!;
10

Use async/await to handle a promise

function fetchData() { const data = fetch(url); }