0
0
Javascriptprogramming~10 mins

JavaScript execution flow - Interactive Code Practice

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

Complete the code to print 'Hello' to the console.

Javascript
console.[1]('Hello');
Drag options to blanks, or click blank then click option'
Alog
Bprint
Cwrite
Decho
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'print' which is not a JavaScript console method.
Using 'write' or 'echo' which are not valid console methods.
2fill in blank
medium

Complete the code to declare a variable named 'count' with value 5.

Javascript
let [1] = 5;
Drag options to blanks, or click blank then click option'
Avar
Bcount
Clet
Dconst
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'var' or 'let' as the variable name instead of the actual name.
Using 'const' which is a keyword, not a variable name.
3fill in blank
hard

Fix the error in the function declaration to correctly define a function named greet.

Javascript
function [1]() {
  console.log('Hi');
}
Drag options to blanks, or click blank then click option'
AfunctionGreet
BgreetFunction
Cgreet()
Dgreet
Attempts:
3 left
💡 Hint
Common Mistakes
Including parentheses in the function name during declaration.
Using invalid function names.
4fill in blank
hard

Fill both blanks to create a for loop that counts from 0 to 4.

Javascript
for (let i = [1]; i [2] 5; i++) {
  console.log(i);
}
Drag options to blanks, or click blank then click option'
A0
B<
C<=
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Starting at 1 instead of 0.
Using <= 5 which would count to 5 instead of 4.
5fill in blank
hard

Fill all three blanks to create an if statement that checks if x is greater than 10 and prints 'Big'.

Javascript
if ([1] [2] [3]) {
  console.log('Big');
}
Drag options to blanks, or click blank then click option'
Ax
B>
C10
Dx > 10
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the whole condition as one blank instead of separate parts.
Using wrong comparison operators like < or =.