2 Matching Annotations
  1. Aug 2022
    1. The main difference between these two syntaxes is that pattern using slashes /.../ does not allow for expressions to be inserted (like string template literals with ${...}). They are fully static

      This is the main difference between creating a regular expression by using slashes /<here your reg exp>/ and creating a new instance of RegExp() class. You cannot use literal template ${varSubstitution}

    1. The unary plus operator (+) precedes its operand and converts it into a number. If it fails to convert the operand into a number, then it returns NaN. The unary (-) operator converts the operand into a number and negates it.

      an alternative to !!, in order to convert null, empty strings, boolean values into 0 or 1.