How to split a string in JavaScript

1 · Tapas Adhikary · April 18, 2022, 11:10 a.m.
JavaScript strings are sequences of characters enclosed in single('') or double quotes(""). We can create a string as a primitive using the string literal or as an object using the String() constructor. String using a string literal, const greeting = "What a beautiful world". String using the String() object, const greeting = new String("What a beautiful world"); JavaScript Split Method The JavaScript string has access to a particular split() method that splits a string into multiple substrings...