1. Truthy and Falsy values:

In JavaScript ,Fasly Values ate or empty string,undefined, null,NaN. false

And Truthy Values are ‘0’,[],{},

const num=-4;

if (num){

console.log(‘condition true’);

}

else {

console.log(‘condition false’);

}

condition true

2.Undefined vs Null:

There are many reason to be undefined is as follws:

Variable declared without values

let jaman

console.log(jaman);

undefined

Function without return

Function without passing value of parameter

Unavailable property of a object

Null: Null means exits no value . Null in JavaScript is an assignment value. You can assign it to a variable.

var demo=null;

console.log(demo);

null

3.Scope,Block-scope:

At First, we talk about…


1.React Virtual DOM: React is most popular frameworks in JavaScript. It creates

User interface (UI) in a efficient way using declarative code. Raect is more fast than Vanila javascript. You can use it to help build single page applications and mobile apps.

How react DOM works that is explain the in following image:

In the image , you can see react makes a Virtual DOM along with browser DOM .when any state is changed that makes diff algorithm which is easy to render the state .

2.React Fundamentals Core concept:

(a):Declarative code: React works in declarative code .To …


1.Var Declaration & hoisting:

Var delaration:

When Var is a available in global you can excess from any scope .But within a function called function that can excess in function scope. It will be undefined outside function scope.

// Global variable-global scope:

var globalVar=”i am global”

// local variable-functon scope

function any(){

var localVar=”i am local”

console.log(globalVar);

console.log(localVar);

}

output//console.log(localVar);undefined

any()

Hoisting: Hoisting is the javascript’s default behavior that move to the top. A variable can be used before declaration or after declaration.

function hoisting(){

console.log(hoistTxt);

var hoistTxt=”hoisting text”

console.log(hoistTxt);

}

hoisting()

output// undefined/ hoisting text

2.Block-Level Declarations:

Var is function scope…


1.String INCLUDES METHOD:

String includes method determines whether one string may be found within another string That returns true or false as appropriate.

const sentence=’i am learning javascript’;

console.log(sentence.includes(‘learning’));

expected output: true

2.Sting indexOf-

It defines the position of string values and numbers .You can get position any value but it should be case sensitive.

const sentence=’i am learning javascript’

console.log(sentence.indexOf(‘learning’));

expected output:5

3.LastIndex of Method:

It generally starts with last index of an array .it is generally used when vales becomes double :

const array=[‘one’, ‘two’, ‘three’, ‘one’]

console.log(array.lastIndexOf(‘one’));

expected output:3

4. concat METHOD

The concat() method is used…


React Hooks Tutorial for Beginners: setting up the project

If you want to follow along with the examples make sure to configure a React development environment:npx create-react-app exploring-hooks

In the beginning there was this.setState

Consider the following example, an ES6 class extending from React.Component, with an internal state:import React, { Component } from "react";

export default class Button extends Component {
constructor() {
super();
this.state = { buttonText: "Click me, please" };
this.handleClick = this.handleClick.bind(this);
}

handleClick() {
this.setState(() => {
return { buttonText: "Thanks, been clicked!" };
});
}

render() {
const { buttonText } = this.state;
return <button onClick={this.handleClick}>{buttonText}</button>;
}
}

rashedul alam

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