Be Sociable, Share!

martes, 17 de mayo de 2022

Review concepts to keep knowledge fresh: JavaScript

What is the correct way to declare a new variable that you can change? 
>> 
let = myName
Let variable can be changed after they are created

What is the outcome of this statement? 
>> 
3 is printed to the console
What are variables used for in JavaScript? 
>> 
For storing or holding data

What is the outcome of the following code snippet?
console.log('Hello world'); 
>>> 
Hello world is printed to the console

What is the correct way to call the random method on the Math global object?
>> 
Math.random()

What is string interpolation?
>> 
Using template literals to embed variables into strings.

Which of the following code snippets would cause an error?
>> 
const food = 'chicken';
food = 'sushi';

What will the following code print to the console? 
>>
let num = 10;
num *= 3;
console.log(num); 
*= will multiply the num by 3 and then reassign the value of num to that result.

Which of the following is an example of a single line comment?
>>  
// creates a single line comment

What is the correct way to call a string’s built-in method?
>>
'here'.toUpperCase(); is a built-in method.

What is string concatenation? 
>>
String concatenation is the process of joining strings together.
 

No hay comentarios:

Publicar un comentario