An interesting tour to the mysterious Javascript

Photo by Ben Kolde on Unsplash

1. Introduction

Types in javascript:

3. String:

"hate".length // output will be 4
'hate'.toUpperCase() // "HATE"
'HATE'.toLowerCase() // 'hate'
'Hate'.toUpperCase().toLowerCase() //'hate'

4. Number:

Math.ceil(1.101) //2
Math.floor(1.101) //1

5. Hey dude you are absolutely wrong:

'a' + 'a' // 'aa'
'1' + '1' // '11'
1 + '1' 

6. confusing types (null and undefined, truthy and falsy):

var a = null
console.log(a) // null
var a;
console.log(a) // undefined

7. objects:

var a = {}
a.name = "leazo"ora[name] = "leazo"
a.walkStyle = function () {
return "speedy"
};
a.name // "leazo"
a.walkStyle() // "speedy"

8. function:

function myFnc()}{
return "hello world"
}
myFnc()  //"hello world"

9. variables:

var name = "tanvir"
name // 'tanvir'
var name;
console.log(name) // undefined

10. scope:

//this is global scope
var a = "a";
function local(){
var b = "b";
var c = b + a;
return c
}
console.log(a) // "a"
console.log(c) // error
var a = "a";
function global(){
var b = "b";
if(true){
var c = b + a;
}
return c
}
global() // "ba"

11. closures:

function parent(){
var a = 10;
return function children(){
var b = 100;
return a+b;
}
}
var c = parent();
c() // 110

I am very passionate about web development, programming. I am very much skilled in javascript, react, html, css, node js, express, mongodb etc.