Day 2: Variables
Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.
Explanation
Variables can be thought of as named containers where we can store data.
Data stored inside a variable can be retrieved by naming it at a later point.
A variable in JavaScript is declared by using the var
keyword:
SAMPLE CODE
var website = "hackerrank"; //Variable Declaration
console.log(website); //Displaying variable website's content to console.
OUTPUT
hackerrank
To learn more about valid JavaScript variable names, click here.
Task
In the editor below, declare a variable named newVariable
and assign it the following string, "My First Variable
".
xxxxxxxxxx
1
//Write your code below this line.