Double equal (==) vs triple equal (===)

Triple equal is called strict equality. Triple equal always checks for the same type and same value. If the values have the same type and same value it returns true otherwise false.

10 === '10'    // false
5 === 5 // true
10 == '10'      // true
1 == true // true

Truthy value vs falsy value

In JavaScript, truthy value means it represents true value. Some truthy values are:

[], {}, true, ‘false’, -5, 5, 7.5

Falsy value means exactly what its name…


What is ReactJS

ReactJS is an open-source, front-end, JavaScript library for building user interfaces or UI components.

It’s not a frame work. It’s a library.

You can choose any of your favorite 3rd party libraries and use them as a plugin.

JSX

JSX stands for JavaScript XML. JSX allows you to write HTML elements in JavaScript and place them in the dom without using React.createElement() method.

Without JSX

const myElement = React.createElement('h1', {style: {color: ‘red’}}, 'Hello World!');

ReactDOM.render(myelement, document.getElementById('root'));
const myelement = <h1>Hello World!</h1>;

ReactDOM.render(myelement, document.getElementById('root'));

Using JS in react

You can also use JS in react…


Var Declarations and Hoisting

All the variables declared with var acted as if they are initialized at the top of the code block. This believer of a var variable is called ‘hoisting’.

function getColor(value) {
if(value > 20) {
var color = 'red';
return color;
} else {
console.log(color) // no error. color is undefine
return "blue";
}
// color is also accessible from here with the value undefine}
function getColor(value) {  var color;  if(value > 20) {

In JavaScript method is a function like other programming languages. Here are a few basic JavaScript methods every developer should know:

Array.prototype.push()

Often you need to add elements to an array. Here comes the push() method. Simply pass the item to the method and the item will be added to the end of the array.

let numbers = [5, 10, 20];
let item = 30;
numbers.push(item); // numbers will be [5, 10, 20, 30]

Array.prototype.pop()

The pop() method simply removes the last element of the array and returns the removed element.

let language = ['C', 'C++', 'JavaScript', 'Python'];
console.log(language.pop()); …

SAYEM MD. NAFI

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