What is Javacript?
Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a “label” to point to the data rather than using the data itself. Any of the eight data types may be stored in a variable.
Variables are similar to the x and y variables you use in mathematics, which means they’re a simple name to represent the data we want to refer to. Computer variables differ from mathematical variables in that they can store different values at different times.
var x = 10;
var y = 20;
Taking Input from user:
To take an input string from console and saving it to a variable, we can write:
var a = readLine()
Now, variable a holds a string which is given as input in the console.
Output “Hello, world!”
To output/print string “Hello, word!” on the console, we can write:
Try the following example in the editor below.
Take a user input string and print space separated “Hello” and input (without quotes).
Read a string input.
Print Hello input to stdout.