What is Javacript?
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
JavaScript is primarily known as the language of most modern web browsers.
Features of JavaScript
Variables :
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.
To define a variable in JavaScript, you use var keyword. For example: 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:
console.log("Hello, world!")
Try the following example in the editor below.
Take a user input string and print space separated “Hello” and input (without quotes).
Input
Read a string input.
Output Format
Print Hello input to stdout.
Example Input
InterviewBit
Example Output
Hello InterviewBit