Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add line number in javascript

const addLineNum = (string) => {
  const newText = string
    .split("
")
    .map((line, index) => `${index + 1}. ${line}`)
    .join("
");
  
  return newText
};
Source by www.textbotonline.com #
 
PREVIOUS NEXT
Tagged: #add #line #number #javascript
ADD COMMENT
Topic
Name
6+1 =