❤1
// #2 declaration of variables
let a = 1 // block scoped variable
var b = 2 // accessible from other blocks{}
const c = 3 // constant variable
// it insures that program will not assign any value to it again
console.log("var1: " + a);
console.log("var2: " + b);
console.log("var3: " + c);
// @JsCode0
let a = 1 // block scoped variable
var b = 2 // accessible from other blocks{}
const c = 3 // constant variable
// it insures that program will not assign any value to it again
console.log("var1: " + a);
console.log("var2: " + b);
console.log("var3: " + c);
// @JsCode0
👍3
// #3 Taking input in node js
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question("Enter a number: ", (num) => {
console.log("You entered: " + num);
});
// @jsCode0
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question("Enter a number: ", (num) => {
console.log("You entered: " + num);
});
// @jsCode0
❤1
// #4 Js list (array) for storing many values
// storing 3 values
let jsArr = [2, 4, 6]
// showing first value
console.log( jsArr[0] )
// @jsCode0
// storing 3 values
let jsArr = [2, 4, 6]
// showing first value
console.log( jsArr[0] )
// @jsCode0
❤1
// #5 Js function
// js function which takes any value and shows them
function show(value){
console.log(value)
}
// call show function with hello value
show("Hello")
// @jsCode0
// js function which takes any value and shows them
function show(value){
console.log(value)
}
// call show function with hello value
show("Hello")
// @jsCode0
// #5 Js function
// js function which takes any value and shows them
function show(value){
console.log(value)
}
// call show function with hello value
show("Hello")
// @jsCode0
// js function which takes any value and shows them
function show(value){
console.log(value)
}
// call show function with hello value
show("Hello")
// @jsCode0
// strings declaration in js
let str = "its js strings"
console.log(str)
let str = "its js strings"
console.log(str)
// integer declaration in js
let num = 76
console.log(num)
let num = 76
console.log(num)