0
0
Javascriptprogramming~10 mins

Why JavaScript is widely used - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print a message in the browser console.

Javascript
console.[1]('Hello, JavaScript!');
Drag options to blanks, or click blank then click option'
Alog
Bprint
Cwrite
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using console.print or console.write which do not exist.
2fill in blank
medium

Complete the code to create a variable named 'name' with the value 'Alice'.

Javascript
let [1] = 'Alice';
Drag options to blanks, or click blank then click option'
Avar
Bname
Clet
Dconst
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'var' or 'const' as variable names instead of 'name'.
3fill in blank
hard

Fix the error in the function declaration to correctly greet a user.

Javascript
function greet([1]) {
  return `Hello, ${name}!`;
}
Drag options to blanks, or click blank then click option'
Aname
BuserName
Cuser
Dgreeting
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different parameter name than the one used inside the function.
4fill in blank
hard

Fill both blanks to create an array of numbers and get its length.

Javascript
const numbers = [[1]];
const length = numbers.[2];
Drag options to blanks, or click blank then click option'
A1, 2, 3, 4, 5
Bsize
Clength
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'size' or 'count' instead of 'length' for array size.
5fill in blank
hard

Fill all three blanks to create an object with a method that returns a greeting.

Javascript
const person = {
  [1]: 'Bob',
  [2]() {
    return `Hi, I am ${this.[3]`;
  }
};
Drag options to blanks, or click blank then click option'
Aname
Bgreet
DsayHello
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent names for the property and inside the method.