About 8,230,000 results
Open links in new tab
  1. javascript - How can I assign a multiline string literal to a variable ...

    Apr 30, 2009 · A simple way to print multiline strings in JavaScript is by using template literals (template strings) denoted by backticks (` `). You can also use variables inside a template …

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

    Aug 27, 2010 · There are actually two ways in which strings can be made in javascript. var str = 'Javascript'; This creates a primitive string value. var obj = new String('Javascript'); This …

  3. What does ${} (dollar sign and curly braces) mean in a string in ...

    Mar 7, 2016 · You can have expressions within the template strings/literals. Example: const one = 1; const two = 2; const result = `One add two is ${one + two}`; console.log(result); // output: …

  4. Sort array by firstname (alphabetically) in JavaScript

    Note that in "real life"™ you often want to ignore case, correctly sort diacritics, weird symbols like ß, etc. when you compare strings, so you may want to use localeCompare. See other answers …

  5. Usage of the backtick character (`) in JavaScript

    Dec 28, 2014 · Backticks in JavaScript is a feature which is introduced in ECMAScript 6 // ECMAScript 2015 for making easy dynamic strings. This ECMAScript 6 feature is also named …

  6. javascript - Generate a string of random characters - Stack Overflow

    Jul 31, 2019 · Not all possible strings of size N may be returned. In the second solution this is obvious (since the smaller string is simply being duplicated), but also in the original answer …

  7. String interpolation in JavaScript? - Stack Overflow

    Jul 20, 2014 · The other important thing is, you don't have to worry about multi-line strings anymore. You can write them simply as > `foo ... bar` 'foo\n bar' Note: I used io.js v2.4.0 to …

  8. How can I get query string values in JavaScript? - Stack Overflow

    May 23, 2009 · This could easily be improved upon to handle array-style query strings too. An example of this is here , but since array-style parameters aren't defined in RFC 3986 I won't …

  9. JavaScript equivalent to printf/String.Format - Stack Overflow

    Mar 4, 2009 · From ES6 on you could use template strings: let soMany = 10; console.log(`This is ${soMany} times easier!`); // "This is 10 times easier!" Be aware that template strings are …

  10. How to interpolate variables in strings in JavaScript, without ...

    JavaScript string interpolation on strings assigned as property values in objects. 1. String interpolation ...

Refresh