Sign in

1. What is Truthy and Falsie Value in JavaScript?

Every integer is true, except 0 (zero), and Every string are true except empty string. Also every undefined variable should be false. Please have look below example.

const age = 4;
const age = 0;
const age = "mehadi";
const age = "";
let age;
let age=NaN;
// Falsie value
// 0
// ""
// undefined
// null
// False
// Truthy value
// 0
// ' '
// []
// {}
const age = " ";
if (age.length > 0) {
console.log("condition is true");
} else {
console.log("condition is false");
}

2. What is the difference between null and undefined?

undefined means when declarer variable but if we…


What is React?

React is a JavaScript library for building user interfaces. Library is a collection of code, by re-using it we can make our application. React works as like this. React use some collection of Vanilla JavaScript code and create application, website, mobile application and desktop application user interface.

How do we use React?

When we use react we only needed to include f JavaScript files to get everything working.

<html>
<head>
<meta charset="utf-8">
<title>Hello world</title>
<!-- Script tags including React -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/reactdom.min.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js">
</script>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
ReactDOM.render(
<h1>Hello world</h1>,
document.querySelector('#app')
);
</script>
</body>
</html>

This is the example…


Block Bindings

In JavaScript when we use variable, we actually bind it. So what is binding? When we declare and/or initialize a variable, we actually bind a value to in its name inside the scope of the program.

var x;
let y;
const z = nextValue;

Var Declarations and Hoisting

var a = 5;
if (true){
var a = 5;
console.log(a); // 5
}
console.log(a); // 5

In ‘var’ keyword variable declaration we can use variable’s values every where from the scope, and this is a problem, for this issues ES6 we use ‘let’ & ‘const’ keyword.

x=40;
console.log(x); //40
var x;

In the above code…


Math.Abs( )

In JavaScript Math.Abs return absolute value. What is absolute value?

Absolute value is always positive value.

Math.Abs (-4) = 4

Math .ceil( )

In JavaScript Math.ceil return greater value

Math.ceil(1.1) = 2

Math.ceil(1.6) = 2

Math.floor( )

In JavaScript Math.floor return Round number

Math.floor (3.2) = 3

Math.floor (3.6) = 3

Math.min( )

In JavaScript Math.min return the number with lowest value

Math.min(3,2,1,-2) = -2

Math.max( )

In JavaScript Math.max return the number with highest value

Math.max (5, 7, 3, 6) = 7

Math.random( )

In JavaScript Math.random return random value in between 1

Math.random();

0.8016483059201462, 0.7975386897971375, 0.86067019276252, ……………….

Math round( )

In JavaScript Math.round return round value of nearest integer

Math.round(2.4) = 2


JavaScript is most powerful browser based scripting language. Now days it is used an incredible number of high-profile applications.

JavaScript was created in 1995 by Brendan Eich. JavaScript is a dynamic language for its types and operators structure .

Number

String

Boolean

Function

Object (Function, Array, Date RegExp)

Symbol (new in ES2015)

Number

Math.sin() = It gives the numeric number

parseInt() = Convert a string to an integer

parseFloat() = gives floating number (Ignore everything if contain any sign (+, -, .)

NaN = Not a Number

isNaN(‘hello’); // true

isNaN(‘1’); // false

String

For showing or counting single charter we use…

Mehadi Hasan

Hello, I am Mehadi Hasan, Frontend React web Developer. From my little knowledge about JavaScript I am trying to publish somethings.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store