Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to remove a part of a string javascript

let string = "My name is Shumail";
let toBeRemove = "Shumail";
string = string.replace(tobeRemove,'');
Comment

javascript string remove substring

var string = "data-123";
string = string.replace('data-','');
alert(string)
Comment

remove part of string javascript

var str = "test_23";
alert(str.split("_").pop());
// -> 23
alert(str.split("_").shift());
// -> test

var str2 = "adifferenttest_153";
alert(str2.split("_").pop());
// -> 153
Comment

PREVIOUS NEXT
Code Example
Javascript :: A form label must be associated with a control react 
Javascript :: change list of objects to list js 
Javascript :: adonis count with where 
Javascript :: remove after js 
Javascript :: javascript sort array alphabetically 
Javascript :: check if a class exists javascript 
Javascript :: jquery innerhtml 
Javascript :: redirect javascript code 
Javascript :: javascript document redirect 
Javascript :: javascript redirect to another url example 
Javascript :: javascript array distinct 
Javascript :: array.foreach 
Javascript :: Javascript looping through table 
Javascript :: javascript make new date from hour 
Javascript :: js get file content from url 
Javascript :: how to find factorial of a number using Recursion in javascript 
Javascript :: sequelize update record 
Javascript :: download image jquery onclick 
Javascript :: javascript array remove empty strings 
Javascript :: javascript queryselector starts with 
Javascript :: javascript average function 
Javascript :: checkbox on click jquery 
Javascript :: javascript sort object by key 
Javascript :: printf javasscript 
Javascript :: ajax authorization header token 
Javascript :: js create timestamp with 10 digits 
Javascript :: get the value or text from select element using javaScript 
Javascript :: set element position js 
Javascript :: color console 
Javascript :: javascript fill array 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =