Created
April 7, 2019 05:02
-
-
Save lakshmananmurugesan/b38b4c86cf6be7773094fd2ef996928d to your computer and use it in GitHub Desktop.
JS upto date()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is comment | |
/* | |
this is multi | |
level | |
comment | |
*/ | |
document.write("print this"); | |
// window.alert(5 + 6); | |
console.log('in console'); | |
var a, b, c; | |
var person = "John Doe", carName = "Volvo", price = 200; | |
// undefined | |
a = 5; b=6; | |
c = a+b; | |
console.log(c); | |
console.log(typeof(c)); | |
console.log('operators', (5 + 6) * 10); | |
var txt1 = "John"; | |
var txt2 = "Doe"; | |
var txt3 = txt1 + " " + txt2; | |
var z = "Hello" + 5; | |
console.log(true == true); | |
var cars = ["Saab", "Volvo", "BMW"]; | |
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}; | |
// primitive data types: string, number, boolean, undefined | |
function myFunction(p1, p2) { | |
return p1 * p2; // The function returns the product of p1 and p2 | |
} | |
// var x = toCelsius(77); | |
function myFunction() { | |
document.getElementById('example').innerHTML = 'Changed'; | |
} | |
"some text".length | |
var str = "Apple, Banana, Kiwi"; | |
var res = str.substring(7, 13); | |
// indexOf, replace, toUpperCase(), concat, trim, charAt, split | |
var x = 100 / "Apple"; // number type | |
// toString(), toFixed(), toPrecision() Number methods | |
// length, sort(), push(), join(), pop(), shift(), unshift(), delete, concat Array methods | |
console.log(new Date()); | |
var d = new Date(2018, 0, 24, 10, 33, 30); | |
console.log(d); | |
console.log(new Date().toUTCString()); | |
console.log(new Date().toDateString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment