About 50 results
Open links in new tab
  1. How do I chop/slice/trim off last character in string using …

    Be aware that String.prototype.{ split, slice, substr, substring } operate on UTF-16 encoded strings None of the previous answers are Unicode-aware. Strings are encoded as UTF-16 in most …

  2. Check if a variable is a string in JavaScript

    In JavaScript you can have variable type of string or type of object which is class of String (same thing - both are strings - but defined differently) thats why is double checked.

  3. String interpolation in JavaScript? - Stack Overflow

    Jul 20, 2014 · 217 Douglas Crockford's Remedial JavaScript includes a String.prototype.supplant function. It is short, familiar, and easy to use:

  4. How can I use backslashes (\) in a string? - Stack Overflow

    In JavaScript, the backslash has special meaning both in string literals and in regular expressions. If you want an actual backslash in the string or regex, you have to write two: \\.

  5. What is the correct way to check for string equality in JavaScript ...

    In all other cases, you're safe to use ==. Not only is it safe, but in many cases it simplifies your code in a way that improves readability. I still recommend Crockford's talk for developers who …

  6. How do I check for an empty/undefined/null string in JavaScript?

    It works on a null string, and on an empty string and it is accessible for all strings. In addition, it could be expanded to contain other JavaScript empty or whitespace characters (i.e. …

  7. Parsing a string to a date in JavaScript - Stack Overflow

    How can I convert a string to a Date object in JavaScript? var st = "date in some format" var dt = new Date (); var dt_st = // st in Date format, same as dt.

  8. How to use \\n in a javascript string - Stack Overflow

    How to use \n in a javascript string Asked 7 years, 11 months ago Modified 2 years ago Viewed 126k times

  9. What is the JavaScript string newline character? - Stack Overflow

    Is \\n the universal newline character sequence in JavaScript for all platforms? If not, how do I determine the character for the current environment? I'm not asking about the HTML newline …

  10. Determine if string is in list in JavaScript - Stack Overflow

    Mar 12, 2010 · However, it is a far superior solution to String.prototype.isInList = function() { ... } because using simple assignment like that will create an enumerable property on …