Complete the code to declare a variable with dynamic typing.
let value = [1];In JavaScript, variables can hold any type. Here, we assign a string "hello" to the variable.
Complete the code to change the variable type dynamically.
let data = 10; data = [1];
JavaScript allows changing the type of a variable. Here, we change from number 10 to string "twenty".
Fix the error by completing the code to convert a number to a string.
let num = 5; let str = num[1];
The toString() method converts a number to a string in JavaScript.
Fill both blanks to create a variable that changes from boolean to string.
let flag = [1]; flag = [2];
Initially, flag is a boolean true. Then it changes to the string "true".
Fill all three blanks to create a variable that changes from number to string and then to boolean.
let val = [1]; val = [2]; val = [3];
The variable val starts as number 100, then changes to string "100", and finally to boolean false.