About 264,000 results
Open links in new tab
  1. How to give space or next line feature in javascript?

    Apr 21, 2014 · To jump to next line you need to use \n and for space no need to to write &nbsp, simply write whitespace character, You can use the JS Escape Characters in a string (ref: http://www.w3schools.com/js/default.asp) : use: space. new line. your code will be:

  2. How can I replace newlines/line breaks with spaces in javascript?

    In case there are multiple line breaks (newline symbols) and if there can be both \r or \n, and you need to replace all subsequent linebreaks with one space, use. var new_words = words.replace(/[\r\n]+/g," "); See regex demo. To match all Unicode line break characters and replace/remove them, add \x0B\x0C\u0085\u2028\u2029 to the above regex:

  3. How to create string with multiple spaces in JavaScript

    Nov 5, 2015 · With template literals, you can use multiple spaces or multi-line strings and string interpolation. Template Literals are a new ES2015 / ES6 feature that allows you to work with strings. The syntax is very simple, just use backticks instead of single or double quotes:

  4. How to Set the Distance between Lines in a Text with JavaScript

    Aug 5, 2024 · In this article, we will see how to create a user-defined space between two consecutive lines to beautify the view using JavaScript. To set the distance between lines, we can use the line height Property. The line-height property is used to …

  5. How to add new line in string? - JavaScript - The freeCodeCamp Forum

    Jul 6, 2016 · The white-space property adjusts how an element handles white space in its inner text. And the value no-wrap preserves the white space, including line breaks. You can read more about the white-space property and its different values here: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

  6. Spacing and New Lines in JavaScript - Treehouse

    Learn how you might use spaces, tabs, and newline characters to make your code easier to read and understand.

  7. Create a string with multiple spaces in JavaScript

    Jun 24, 2024 · Below are the methods to create a string with multiple spaces in JavaScript: This method gets a part of a string, starts at the character at the defined position, and returns the specified number of characters. Example 1: This example adds spaces to the string by &nbsp.

  8. JavaScript Best Practices — Spaces | by John Au-Yeung - Medium

    Jun 9, 2020 · In this article, we’ll look at how to properly space out the JavaScript code. If we have method chains, then we should indent the method calls so that we see the chain more easily. We instead...

  9. javascript - How to reduce amount of space between lines of text ...

    Jul 10, 2012 · You can just set the line-height in your CSS, depending on the text that you want to decrease the space in between. Example:.pds-answer-group { padding-top:1px !important; padding-bottom:1px !important; margin-top:1px !important; margin-bottom:1px !important; height:auto; overflow:hidden; line-height:9pt /* worked when i changed this from 50% */ }

  10. Various methods for a JavaScript new line - Flexiple

    Mar 11, 2022 · Discover multiple techniques to create new lines in JavaScript effortlessly. Explore different approaches for formatting text output efficiently.

  11. Some results have been removed
Refresh