JavaScript Tracy Topic

kawcher habib
2 min readMay 8, 2021

JavaScript some tricky topics those you must be known. this article I want to share with you this

The first one truthy and flashy value truthy that means true and flashy which means false every developer calls this truthy and flashy. we are more knowledgeable about this some example

Truthy value

  1. while the number is truthy without 0 for example

var num = 12;

output= truthy; and

var num = 0;

output = flashy;

2. while the string is truthy without an empty string for example

const name = ‘kawcher ahbib’; output = truthy

const name = ‘’ output = flashy

//truthy value

  • 12 -12 or ‘0’ ‘hello’ or ‘ ’

//flashy value

  • 0, ‘’, undefined, null, NaN

Null vs Undefined Which One Is The Best For Find Your Girlfriend

In this article, I discuss null and undefined

Undefine

most of the case you get undefine from you mistakes example

you use var key without value

var name ; output = undefine

function num( num1, num2) {

console.log( num1 + num2)

}

num(20, 10) output = undefine

why????

because you don’t use the return key

but if you use the return key without value then it gives you undefine

Null

If you use this key then you get null for example

const num = null; you get output = null;

Check Your Orginal Girlfriend Using equal

as a web developer, you know that double equal triple equal

== double equal use for check just value

example var num1 = 12;

var num2 = ‘12’

if( num1 == num2){

console.log(“12”)

} else{

console.log(‘this is not 12’)

}

output = 12

but if you use === triple equal it’s checking your value and type

example

let num1 = 12;

let num2 = ‘12’;

if(num1 === num2){

console.log(‘it is right’)

}else{

console.log(‘it is not right)

}

output = it is not right

because of this var key value, we use two type number and string

JavaScript Scope

Scope that means your area which area you go and don’t go

for example

function yourNumber( num1, num2){

const result = num1 + num2

console.log(result)

}

yourNumber(12,20) this way you get input right value but

if you want to access outside of function then you don’t get output

example: function yourNumber( num1, num2){

const result = num1 + num2

}

console.log(result) output = undefine

yourNumber (12,20)

bind call and apply why use and how use?

bind we use this key object and another object to bind

example

var object1 = {

name = ‘kawcher’;

number = 00234049495

}

var object2 = {

name = ‘habib’

number = 8945849584

}

console.log(object1.baind(object2))

call using

console.log(object1.call(object2, joshime, 344545))

apply

console.log(object1.apply(object2, [korim, 2005458]))

window, global secop

window is a browser enverment

globle secop it’s use or access globale

--

--