• 22 May

    TypeError: replace is not a function in JavaScript

    TypeError: .replace is not a function occurs when we call replace() function on object which is not an string. replace() function can be only called on string. Let’s see with help of simple example where we want to remove . from number. For example: 1.23 should become 123. [crayon-6289e5257205a201146994/] You will get following error when […]

  • 22 May

    How to Unpack Array in JavaScript

    In this post, we will see how to unpack array in JavaScript. Ways to Unpack array in JavaScript There are multiple ways to do it. Let’s go through them. Using Destructuring Syntax To Unpack array in Javascript into separate variable: Use destructuring assignment to unpack array in separate variable. Let’s see with the help of […]

  • 21 May

    Convert epoch time to Date in Javascript

    In this post, we will see how to convert Convert epoch time to Date Javascript. There are multiple ways to do it. Let’s go through them. Using Date’s setUTCSeconds() To convert epoch time to Date in Javascript: Create Date object by passing 0 in its constructor. When you pass 0 to Date’s constructor, it will […]

  • 21 May

    How to Clear Array in TypeScript

    In this post, we will see how to clear array in Typescript. There are multiple ways to do it. Let’s go through them. By setting array’s length to 0 To clear array in TypeScript: Set length of array to 0. When length property is changed, all the elements that have index larger than its length […]

  • 21 May

    [Fixed] TypeError: Assignment to constant variable in JavaScript

    Problem : TypeError: Assignment to constant variable TypeError: Assignment to constant variable in JavaScript occurs when we try to reassign value to const variable. If we have declared variable with const, it can’t be reassigned. Let’s see with the help of simple example. [crayon-6289e52575039050092342/] Output [crayon-6289e52575041048196474/] Solution : TypeError: Assignment to constant variable Rename the […]

  • 20 May

    [Fixed] Syntaxerror: invalid shorthand property initializer in Javascript

    Syntaxerror: invalid shorthand property initializer error comes when we use equals operator rather than colon to separate key-values(properties) in object. To resolve this issue, we need to use colon(:) rather than equals operator(=) between key and values of an object Let’s see with the help of example: [crayon-6289e52575b38616920374/] Notice that we have used = between […]

  • 20 May

    [Fixed] TypeError: map is not a function in Javascript

    map is not a function in Javascript TypeError: .map is not a function occurs when we call map() function on object which is not an array. map() function can be only called on array. Let’s see with help of simple example: [crayon-6289e52576507495003828/] You will get following error when you execute the program: [crayon-6289e5257650f558070135/] We got […]

  • 19 May

    Remove xa0 from String in Python

    In this post, we will see how to remove xa0 from String in python Python programmers have to deal with large amounts of various Unicode characters that appear when parsing HTML files and while using the Beautiful Soup library for dealing with HTML files. One such Unicode character is the xa0, which represents spaces in […]

  • 19 May

    If-else in one line in Python

    The if-else statement is one of the common statements of many programming languages like Python, C/C++, and Java. It is a conditional statement and is used to perform some action based on a condition. With the if-else statement, we run a block of code based on the evaluation of a provided condition. If the condition […]