////////JavaScript Data Types////////////
let NAME = 'ASWIN'; ///String
console.log(NAME); ///String
//////////////////////////////////////////
let NUMBER = 18; ///Number
console.log(NUMBER); ///Number
//////////////////////////////////////////
let AS = {FIRST:'ASWIN', LAST:'B'}//Object
console.log(AS); ///Object
//////////////////////////////////////////
let NOVALUE = null; ///null
console.log (NOVALUE); //null
////////////////////////////////////////
let Boolean =false; ///Boolean
console.log(Boolean); ///Boolean
/////////////////////////////////////////
let C =['aswin','appu','hello']; ///Array
console.log(C); //Array
///////////////////////////////////////////
strings common methods
------------------------------
////length////
let a = 'aswin';
console.log(a.length);
////////////////////
console.log(a.toUpperCase(a));
////////////////////////////
console.log(a.toLowerCase(a));
//////////////////////////////
console.log(a.replace('as','af'));
////////////////////////////////
console.log(a.slice(2,3));
-------------------------------------
loops
//while loop
var num = 0;
while(num < 10){
num +=1;
console.log(num);
}
//for loop
for (let num = 0; num < 100; num++) {
console.log(num);
}
how to we add 2 numbers together in fuction javascript
------------------------------------------------------
function num(n1,n2){
var result = n1+n1;
console.log(result);
}
num(10,10);
No comments:
Post a Comment