how to get string after colon in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get string after colon in javascript, use split() method with pop() method it will return those string which after then your colon or which you used to split the string. Let鈥檚 see short example to use split() method with pop() method to get string after colon. string.split(":").pop(); Today, I鈥檓 going to show you How do I get string after colon in javascript, as above mentioned, I鈥檓 going to use the above-mentioned split() method with pop() method....

August 25, 2022聽路聽2 min聽路聽Infinitbility

how to get string after specific word in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get string after specific word in javascript, use split() method with pop() method it will return those string which after then your specific word or which you used to split the string. Let鈥檚 see short example to use split() method with pop() method to get string after specific word. string.split("WORD").pop(); Today, I鈥檓 going to show you How do I get string after specific word in javascript, as above mentioned, I鈥檓 going to use the above-mentioned split() method with pop() method....

August 24, 2022聽路聽2 min聽路聽Infinitbility

how to get string after specific character in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get string after specific character in javascript, use split() method with pop() method it will return those string which after then your specific character or which you used to split the string. Let鈥檚 see short example to use split() method with pop() method to get string after specific character. string.split("-").pop(); Today, I鈥檓 going to show you How do I get string after specific character in javascript, as above mentioned, I鈥檓 going to use the above-mentioned split() method with pop() method....

August 23, 2022聽路聽2 min聽路聽Infinitbility

how to get last word of string in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last word of string in javascript, 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 text.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 javascript, as above mentioned, I鈥檓 going to use the above-mentioned split() method....

August 20, 2022聽路聽1 min聽路聽Infinitbility

how to get first word of string in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first word of string in javascript, 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 javascript, 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 in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To each character of string in javascript, 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 javascript, as above mentioned, I鈥檓 going to use the for....

August 18, 2022聽路聽1 min聽路聽Infinitbility

how to get last two character of string in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last two character of string in javascript, 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 javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last character of string in javascript, 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 javascript, 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 javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first two character of string in javascript, 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. text.substring(0, 2); Today, I鈥檓 going to show you How do I get first two character of string in javascript, as above mentioned, I鈥檓 going to use the above-mentioned substring() method....

August 15, 2022聽路聽1 min聽路聽Infinitbility

how to get first character of string in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get first character of string in javascript, 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 javascript, as above mentioned, I鈥檓 going to use the above-mentioned substring() method....

August 13, 2022聽路聽2 min聽路聽Infinitbility

how to get json array length in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get length of json array in javascript, use .length property it will return number of element avaialable in json array. Let鈥檚 see how to use .length property in json array variable. let arr = ["Infinitbility", "aGuideHub", "SortoutCode"]; console.log(arr.length); // Output // 3 Today, I鈥檓 going to show you How do I get json array length in javascript, as above mentioned, I鈥檓 going to use the above-mentioned Array....

August 12, 2022聽路聽1 min聽路聽Infinitbility

how to get value from json array in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get value from json array in javascript, we have two ways use index number to single specfic value from json array use for loop to get all values from json array Let鈥檚 see short example to use index number and for loop on json array. let arr = ["Infinitbility", "aGuideHub", "SortoutCode"]; // used `index` number console.log(arr[1]); // Output // aGuideHub // used `for` loop for(let value of arr) { console....

August 12, 2022聽路聽2 min聽路聽Infinitbility

how to handle apostrophe in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To handle apostrophe ( single quote, or double quote ) in javascript, 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 empty an array in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To empty an array in javascript, use the splice() method with array length it will delete all elements of the array without compromise with reference, and also it is one of the fastest ways to empty an array. The splice() method takes the index (from which the splicing should start ) and the number of items to be removed as parameters and splices the elements....

August 2, 2022聽路聽1 min聽路聽Infinitbility

how to pass parameter to a promise function in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To pass parameters to a promise function in javascript, 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 javascript, 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 check null value in json object in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To check the null value in a JSON object in javascript, Just use the if statement or ternary operator before using the JSON object value. it will handle all falsy values with null. JavaScript if statement or ternary opertor will handle (""), null, undefined, false and the numbers 0 and NaN. Let鈥檚 take a short example check the null value in JSON object in javascript....

July 31, 2022聽路聽2 min聽路聽Infinitbility

how to set value in json object in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To set value in JSON object in javascript, we have multiple ways Set the value at the time of creating JSON object Set value using the key in JSON object Set value using dynamic key in JSON object Let鈥檚 take a short example of all the above methods. // Set value at the time of creating JSON object let obj = { id: 1 } // Set value using key in json object obj....

July 30, 2022聽路聽2 min聽路聽Infinitbility

how to call script type module function in javascript?

To call script type module function in javascript, assign function in window object, then you can call a function from anywhere. let鈥檚 take an example of creating and assigning a function in a window object. <script type="module"> window.showAlert = function showAlert() { alert("Button Clicked"); }; </script> Today, I鈥檓 going to show you How do I call script type module function in javascript, as above mentioned here, I鈥檓 going to use the window object to make the function accessible....

July 26, 2022聽路聽1 min聽路聽Infinitbility

how to upload base64 image to ipfs?

To upload a base64 image to ipfs, convert the base64 image to a blob using the fetch() method and then you can able to upload the base64 image to IPFS. Take the sort of example of uploading a base64 image to IPFS. const response = await fetch(base64Image); const blob = await response.blob(); const file = new File([blob], "file.png", { type: "image/png" }); const imghash = await ipfs.add(file); Today, I鈥檓 going to show you How do I upload base64 images to ipfs, as above mentioned here, I鈥檓 going to use the fetch() method to make files uploadable and ipfs-http-client package to upload file in IPFS....

July 26, 2022聽路聽2 min聽路聽Infinitbility

how to remove space between strings in javascript?

Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To remove space between strings in javascript, just use the replace() method with the /\s/g regex then it will return a new string without spaces. The replace() method returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match....

July 23, 2022聽路聽2 min聽路聽Infinitbility