## How to divide two numbers in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To divide two numbers in react js, use the / operator it will divide it when your value datatype is a number else if your value datatype is string first convert it using parseInt() and then perform the division operation. In the following example, we will take the sample numbers, and strings and perform the divide operation using the / division operator. Dividing Two numbers example let num1 = 3; let num2 = 9; num2 / num1; // 3 Dividing Two string numbers example let num1 = "3"; let num2 = "9"; parseInt(num2) / parseInt(num1); // 3 Today, I鈥檓 going to show you How do i divide two numbers in react js, as mentioned above here, I鈥檓 going to use the / division operator....

October 14, 2022 路 2 min 路 Infinitbility

## How to multiply two numbers in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To multiply two numbers in react js, use the * multiplication operator it will multiply it if your value datatype is a number else if your value datatype is string first convert it using parseInt() and then perform multiplication operation. In the following example, we will take the sample numbers, and strings and perform a multiply operation using the * multiplication operator. Multiplying Two numbers example let num1 = 3; let num2 = 3; num2 * num1; // 9 Multiplying Two string numbers example let num1 = "3"; let num2 = "3"; parseInt(num2) * parseInt(num1); // 9 Today, I鈥檓 going to show you How do i multiply two numbers in react js, as mentioned above here, I鈥檓 going to use the * multiplication operator....

October 13, 2022 路 2 min 路 Infinitbility

## How to subtract two numbers in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To subtract two numbers in react js, use the - subtraction operator it will subtract it when your value datatype is a number else if your value datatype is string first convert it using parseInt() and then perform the subtraction operation. In the following example, we will take the sample numbers, and strings and perform subtract operations using the - subtraction operator. Subtracting Two numbers example let num1 = 30; let num2 = 34; num2 - num1; // 4 Subtracting Two string numbers example let num1 = "30"; let num2 = "34"; parseInt(num2) - parseInt(num1); // 4 Today, I鈥檓 going to show you How do i subtract two numbers in react js, as mentioned above here, I鈥檓 going to use the - subtraction operator....

October 12, 2022 路 2 min 路 Infinitbility

## how to get last word of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last word of string in react js, use split(" ") method with strArr.length - 1 index value it will return last word from string. You have to only pass " " in split() method. Let鈥檚 see short example to use split(" ") with with strArr.length - 1 index to get last word from string. let strArr = string.split(" "); strArr[strArr.length - 1]; Today, I鈥檓 going to show you How do I get last word of string in react js, as above mentioned, I鈥檓 going to use the above-mentioned split() method....

August 22, 2022 路 2 min 路 Infinitbility

## how to get first word of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first word of string in react js, use split(" ") method with 0 index value it will return first word from string. You have to only pass " " in split() method. Let鈥檚 see short example to use split(" ") with with 0 index to get first word from string. string.split(" ")[0]; Today, I鈥檓 going to show you How do I get first word of string in react js, as above mentioned, I鈥檓 going to use the above-mentioned split() method....

August 19, 2022 路 1 min 路 Infinitbility

## how to get each character of string of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To each character of string in react js, use for...of loop, it will return each character one by one. You have to just use for...of loop on your string string. Let鈥檚 see short example to use for loop on string to get each char. for (let char of string) { console.log(char) } Today, I鈥檓 going to show you How do I get each character of string in react js, as above mentioned, I鈥檓 going to use the for....

August 18, 2022 路 2 min 路 Infinitbility

## how to get last two character of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last two character of string in react js, use substring() method to extracts last two character from string. You have to only pass starting and ending postion of string so for last two character pass text.length - 2 as parameter it will return last two character of string. Let鈥檚 see short example to use substring() to get last two character from string....

August 17, 2022 路 1 min 路 Infinitbility

## how to get last character of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last character of string in react js, use substring() method to extracts last character from string. You have to only pass starting and ending postion of string so for last character pass text.length - 1 as parameter it will return last character of string. Let鈥檚 see short example to use substring() to get last character from string. text.substring(text.length - 1); Today, I鈥檓 going to show you How do I get last character of string in react js, as above mentioned, I鈥檓 going to use the above-mentioned substring() method....

August 16, 2022 路 2 min 路 Infinitbility

## how to get first two character of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first two character of string in react js, use substring() method to extracts first two character from string. You have to only pass starting and ending postion of string so for first two character pass 0, 2 as parameter it will return first two character of string. Let鈥檚 see short example to use substring() to get first two character from string....

August 15, 2022 路 1 min 路 Infinitbility

## how to get first character of string in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first character of string in react js, use substring() method to extracts first character from string. You have to only pass starting and ending postion of string so for first character pass 0, 1 as parameter it will return first character of string. Let鈥檚 see short example to use substring() to get first character from string. text.substring(0, 1); Today, I鈥檓 going to show you How do I get first character of string in react js, as above mentioned, I鈥檓 going to use the above-mentioned substring() method....

August 14, 2022 路 2 min 路 Infinitbility

## how to remove item from object in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To remove item from object in react js, use delete keyword it will remove key value pair from object only you have to mantion delete keyword with key. Let鈥檚 see how to use delete keyword to remove item from object. let exampleObject = { id: 1, name: "infinitbility", error: "Feild required" }; console.log("exampleObject", exampleObject); // Output // 'exampleObject' { // id: 1, // name: 'infinitbility', // error: 'Feild required' // } delete exampleObject....

August 10, 2022 路 2 min 路 Infinitbility

## how to handle apostrophe in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To handle apostrophe ( single quote, or double quote ) in react js, use the ( \ ) Escape characters or ( ` ) Template literals it will handle both types quotes single and double. Let鈥檚 see how Escape characters and Template literals will solve the issue. let brokenString = 'I'm a broken string'; console.log(brokenString); // Output // unknown: Unexpected token (1:24) brokenString = 'I\'m a broken string'; console....

August 9, 2022 路 2 min 路 Infinitbility

## how to check nan in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To check or handle NaN in react js, use the isNaN() method it will return if the value is not a number, if the value is a number it will return false. Let鈥檚 understand when the isNaN method returns false or when true. Number.isNaN(NaN); // true Number.isNaN(Number.NaN); // true Number.isNaN(0 / 0); // true // e.g. these would have been true with global isNaN() Number....

August 8, 2022 路 2 min 路 Infinitbility

## how to check undefined in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To check or handle undefined in react js, use the if statement it will go inside in if statement if the value is not undefined. Basically, If the statement will handle all your false values like 0, false, "", undefined, etc. let value = undefined; if(value){ console.log("value have some data") } else { console.log("value is undefined") } Today, I鈥檓 going to show you How do I check or handle undefined in react js, as above mentioned, I鈥檓 going to use the if statement to check value is undefined or has some data....

August 5, 2022 路 2 min 路 Infinitbility

## how to remove duplicates from array in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To remove duplicates from array in react js, use the new Set() method with it will create new array without dublicate elements. The Set object lets you store unique values of any type, whether primitive values or object references. To use new set in array you have to follow below syntax. [...new Set(arr)] Today, I鈥檓 going to show you How do I remove duplicates from array in react js, as above mentioned, I鈥檓 going to use the above-mentioned new Set() method to get only unique elements of array....

August 4, 2022 路 2 min 路 Infinitbility

## how to remove duplicates from array in react native?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To remove duplicates from array in react native, use the new Set() method with it will create new array without dublicate elements. The Set object lets you store unique values of any type, whether primitive values or object references. To use new set in array you have to follow below syntax. [...new Set(arr)] Today, I鈥檓 going to show you How do I remove duplicates from array in react native, as above mentioned, I鈥檓 going to use the above-mentioned new Set() method to get only unique elements of array....

August 4, 2022 路 2 min 路 Infinitbility

## how to empty an array in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To empty an array in react js, set [] empty array in a state it will remove the existing array of elements and store a new empty array in a state. setArr([]); Today, I鈥檓 going to show you How do I empty an array in react js, as above mentioned, I鈥檓 going to use the above-mentioned set [] empty array syntax method to empty an array....

August 2, 2022 路 1 min 路 Infinitbility

## how to pass parameter to a promise function in react js?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To pass parameters to a promise function in react js, create a parameter function and use promise in a function like the below example. var getNameById = function (id) { return new Promise(function (resolve, reject) { // ... }); }; getNameById(3).then(function (res) { console.log(res); }); // output: "Stuff worked" Today, I鈥檓 going to show you How do I pass parameters to a promise function in react js, as above mentioned, I鈥檓 going to use the above-mentioned syntax to create and use a promise function with a parameter....

August 1, 2022 路 2 min 路 Infinitbility

## how to get browser name in react js?

To get the browser name in react js, install the platform package and call platform.name it will return the browser name. Take the example of using the platform package to get the browser name in react js. import platform from 'platform'; platform.name; // 'IE' ( your users browser name ) Today, I鈥檓 going to show you How do I get the browser name in react js, as above mentioned here, I鈥檓 going to use the platform package to check the browser name....

July 25, 2022 路 1 min 路 Infinitbility

## how to get browser version in react js?

To get the browser version in react js, install the platform package and call platform.version it will return the browser version. Take the example of using the platform package to get the browser version in react js. import platform from 'platform'; platform.version; // '10.0' Today, I鈥檓 going to show you How do I get the browser version in react js, as above mentioned here, I鈥檓 going to use the platform package to check the browser version....

July 25, 2022 路 1 min 路 Infinitbility