Sign in

1.truthy or falsy :

a. any number without 0 is true number. 0 is a falsy number

let age = 18;if(age){console.log(`condition is true`) // expected output condition is true} else {console.log(`condition is false`)}
let greetings = ‘’;if(greetings){console.log(‘condition is true’);} else {console.log(‘condition is false’); // expected output condition is false}
let greetings;if(greetings){console.log(‘condition is true’);} else {console.log(‘condition is false’); //expected output condition is false}

What’s React?

React is a opensource JavaScript library used for building user interface built by facebook. Every developer asked a question why react called library why not framework? So, let’s explore them.

React called library because it’s not a complete solution like any kind of framework. You will often used more library in react. That’s means we used other library in react whether a framework doesn’t support. Every framework has own codebase that’s you must be used. For experienced developer who work’s on large codebase, framework are deal-breaker.

What’s React State?

state is current moment of UI’s .e.g: If you browse facebook you saw (something)…


JavaScript is lightweight , interpreted , object-oriented programming language with first-class function for web pages. In programming we need to store data. Each data has own data type like string, number, array etc. Sometimes for coding purpose we want to conversion this datatype. So, in this article we learn how to conversion data types with each other in JavaScript.

  1. number to string: Any kinds of number(integer, decimal) without wrapping in quotation is called number data type. There is a simplest way to convert number to string is wrapped number with (‘ ‘) or (‘’ ‘’) quotation. Some other way to convert this type. So, let’s start to explore them.
let example;example = String(55);console.log(typeof example);
let example;example = ‘5’ + ‘5’;console.log( example);console.log(typeof example);

1.charAt: charAt is a JavaScript string method which using to access value that’s representes the current index inside the chartAt method.

const name = ‘mehedi hasan’;const whichValue = name.charAt(4); // it’s represent dconsole.log(whichValue); //output: d

2.indexOf: Generally indexOf used to search the element which existed or not in a string. That’s syntax is- str.indexOf(searchValue [, fromIndex]). But when search value was an empty string then return index number which exists on second parametres.

const js = ‘I am a javascript lover’;console.log(js.indexOf(‘am’)); //expected output 2console.log(js.indexOf(‘ ‘, 4)); //expected output 4

3.trim,trimStart,trimEnd: trim method used to remove white space from both ends of a string. trimStart is used to remove whitespace from beginning whether trimEnd used to end.

const welcome = ‘ Welcome medium.com ‘;console.log(welcome.trim()); //expected output ‘welcome medium.com’console.log(welcome.trimStart());// expected output ‘welcome medium.com ‘console.log(welcome.trimEnd());// expected output ‘ welcome medium.com’

4.trunc: trunc is a JavaScript method which returns integer part of any decimal number.

var truncNumber = 45.89;console.log(Math.trunc(truncNumber));// expected output 45

5.some: some is JavaScript array method which checks if any of elements in an array pass a test. When any elements pass test then it’s returns a boolean value.

const ages = [10, 15, 18, 20];const adult = ages.some(checkAdult);function checkAdult(age) {return age >= 18;}console.log(adult); // expected output true

6.every: every is a JavaScript array method which checks every elements in an array pass test and when every elements pass test then return true whether it’s returns false.

const ages = [10, 15, 18, 20];const adult =…

Mehedi hasan

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