Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

slice string javascript from index to space

const data ="Hello my name is Hastings"
data = data.slice(0, data.indexOf(" ")); 
console.log(data)
//Output = "Hello"
 
PREVIOUS NEXT
Tagged: #slice #string #javascript #index #space
ADD COMMENT
Topic
Name
6+8 =