Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

remove string from array in js

// if you want to remove ALL occurences
let arr = ['A', 'B', 'C'];
arr = arr.filter(e => e !== 'B'); // will return ['A', 'C']

// if you want to remove ONLY 1st occurence
t = ['A', 'B', 'C', 'B'];
t.splice(t.indexOf('B'), 1); // will return ['B'] and t is now equal to ['A', 'C', 'B']
Comment

PREVIOUS NEXT
Code Example
Javascript :: npm react hook form 
Javascript :: each element in array jquery 
Javascript :: puppeteer how to serch for text 
Javascript :: jquery form serialized data 
Javascript :: hide show div using jquery 
Javascript :: jquery ajax post form 
Javascript :: javascript binary to int 
Javascript :: javascript string into substrings of length 
Javascript :: change video src in javascript 
Javascript :: how to sort by newest document mongoose 
Javascript :: get the placeholder value jquery 
Javascript :: clear cache after ajax success 
Javascript :: adding event on keypress in javascript 
Javascript :: react import font awesome 
Javascript :: js fake promise with timeout 
Javascript :: separate digits in javascript 
Javascript :: How to make string shorter javascript 
Javascript :: cdnjs smeantic ui 
Javascript :: mouse coordinates not match with canvas coordinate 
Javascript :: expo build apk 
Javascript :: npm ERR! code ENOENT npm ERR! syscall rename 
Javascript :: regex find lines containing two strings 
Javascript :: set onclick javascript 
Javascript :: ReferenceError: fetch is not defined 
Javascript :: javascript date set weeks 
Javascript :: remove non-alphanumeric characters and space javascript 
Javascript :: kendo grid get all selected items 
Javascript :: javascript round to 2 decimal places 
Javascript :: js create array with n elements 
Javascript :: javascript check if undefined or null 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =