About 50 results
Open links in new tab
  1. javascript - What is the difference between String.slice and String ...

    Feb 11, 2010 · Syntax: string.slice(start, stop); Syntax: string.substring(start, stop); What they have in common: If start equals stop: returns an empty string If stop is omitted: extracts …

  2. javascript - Add method to string class - Stack Overflow

    Jun 7, 2019 · I'd like to be able to say something like this in javascript : "a".distance("b") How can I add my own distance function to the string class?

  3. javascript - How do you reverse a string in-place? - Stack Overflow

    How do you reverse a string in-place in JavaScript when it is passed to a function with a return statement, without using built-in functions (.reverse(), .charAt() etc.)?

  4. How do I write an extension method in JavaScript?

    Oct 20, 2019 · 215 JavaScript doesn't have an exact analogue for C#'s extension methods. JavaScript and C# are quite different languages. The nearest similar thing is to modify the …

  5. 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. …

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

    Aug 27, 2010 · 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 …

  7. What is the difference between string primitives and String objects …

    JavaScript automatically converts primitives to String objects, so that it's possible to use String object methods for primitive strings. In contexts where a method is to be invoked on a primitive …

  8. javascript - Sort string without any builtin methods - Stack Overflow

    I want to sort a string in javascript without using a built in method, just by using for's and comparisons like 'a' > 'b'; Something that doesn't work: function replaceAt(str, i, char) {

  9. How to do case insensitive string comparison? - Stack Overflow

    Of course, to match the entire string, the regexp can be changed into /^keyword$/.test(source), but 1) if keyword is not a constant, you'd need to do new RegExp('^' + x + '$').test(source) and …

  10. Convert string to Title Case with JavaScript

    Oct 13, 2008 · Learn how to convert strings to title case using JavaScript with examples and discussions on Stack Overflow.