JavaScript Personal Usage
// function to find square root of any number
function findSquateRoot(number) {
const res = Math.sqrt(number);
console.log(res);
}
findSquateRoot(4)
findSquateRoot(100)
// function to add two numbers and print to console
function addNumbers(num1, num2) {
sum = num1 + num2
console.log(sum);
}
addNumbers(10, 20)
addNumbers(30, 40)
// function to return product of two numbers
function findProduct(num1, num2) {
return num1 * num2
}
findProduct(10, 20)
//Date function to print current date and time in Pacific Timezone
const date_1 = new Date();
console.log("Current Date and Time: "+d);
//Date function to print current date and time in Indian Standard Time
const date_2 = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'})
console.log("Current Date and Time: "+d2);
//Using length function to find length of a word
let word_1 = "Sreeja Journal!";
let length_1 = text.length;
console.log("Word length: "+length_1 );
//Javascript escaping
let word_4 = "Sreeja\'s Blog."
console.log(word_4);