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 :: image upload react 
Javascript :: next router 
Javascript :: random letter from a name js 
Javascript :: how to save and use item from local storage javascript 
Javascript :: jquery form submit ajax 
Javascript :: html get class property 
Javascript :: appending an element to another element javascript 
Javascript :: js array to csv download 
Javascript :: js object using variable as key 
Javascript :: click a link with javascript 
Javascript :: componentwillunmount 
Javascript :: react bootstrap form select 
Javascript :: get domain name with regex 
Javascript :: react native webview not working 
Javascript :: async import javascript 
Javascript :: js toggle 
Javascript :: how to convert a queryset into json string 
Javascript :: is function javascript 
Javascript :: adding element to javascript object 
Javascript :: how to convert name to initials in javascript 
Javascript :: javascript null or empty 
Javascript :: javascript execute function by string name 
Javascript :: localstorage try catch 
Javascript :: copy text on click 
Javascript :: convert string to uppercase 
Javascript :: regular expression characters 
Javascript :: object.entries 
Javascript :: default Electron icon is used reason=application icon is not set 
Javascript :: inline styling in react 
Javascript :: javascript class methods 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =