0
0
Javascriptprogramming~10 mins

What execution context is in Javascript - Interactive Code Practice

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

Complete the code to declare a variable inside a function.

Javascript
function greet() {
  let message = [1];
  console.log(message);
}
greet();
Drag options to blanks, or click blank then click option'
Aconsole.log
BHello
C"Hello!"
Dfunction
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string
Using a keyword instead of a string
2fill in blank
medium

Complete the code to create a new execution context by calling a function.

Javascript
function showNumber() {
  console.log(5);
}
[1]();
Drag options to blanks, or click blank then click option'
AshowNumber
Bconsole
Cfunction
Dnumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using a keyword like 'function' instead of the function name
Forgetting the parentheses after the function name
3fill in blank
hard

Fix the error in the code to correctly access a variable inside the execution context.

Javascript
function count() {
  let number = 10;
  console.log([1]);
}
count();
Drag options to blanks, or click blank then click option'
Anumber
BNumber
Ccount
Dnum
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that was not declared
Mixing uppercase and lowercase letters
4fill in blank
hard

Fill both blanks to create an execution context with a local variable and a condition.

Javascript
function checkAge(age) {
  if (age [1] 18) {
    return [2];
  }
  return "Too young";
}
console.log(checkAge(20));
Drag options to blanks, or click blank then click option'
A>=
B"Allowed"
C<
D"Denied"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong comparison operator
Forgetting quotes around the return string
5fill in blank
hard

Fill all three blanks to create a function that returns a greeting with a name.

Javascript
function greetUser([1]) {
  let greeting = `Hello, [2]!`;
  return [3];
}
console.log(greetUser("Alice"));
Drag options to blanks, or click blank then click option'
Aname
B${name}
Cgreeting
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names
Not using template string syntax correctly