Horje
JavaScript - The first word of a string Code Example
JavaScript - The first word of a string
const str = "What day of the week is it?";

// 1) the match() method:
str.match(/^\w+\s/)[0];// => What

// 2) the split() method:
str.split(' ')[0];  // => What

// 3) the slice() method:
str.slice(0, str.indexOf(' ')); // => What




Javascript

Related
how-to-disable-remote-js-debugging-in-react-native Code Example how-to-disable-remote-js-debugging-in-react-native Code Example
Only numbers or string. Input field in React Code Example Only numbers or string. Input field in React Code Example
How to check if JSON is changed in Javascript? Code Example How to check if JSON is changed in Javascript? Code Example
lodash isequal Code Example lodash isequal Code Example
javascript write to text file stack overflow Code Example javascript write to text file stack overflow Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6