What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-23 23:49:06
remove element from array in js
var colors = ["red","blue","car","green"]; var carIndex = colors.indexOf("car");//get "car" index //remove car from the colors array colors.splice(carIndex, 1); // colors = ["red",&... Add solution -
Other 2021-10-23 07:32:13
create a loop that runs through each item in an array
function filteredArray(arr, elem) { let newArr = []; // change code below this line for (let i = 0; i < arr.length; i++) { if (arr[i].indexOf(elem) == -1) { //Checks every parameter for the element and if is NOT there continues the cod... Add solution -
Javascript 2021-10-23 04:41:12
js indexof string
//indexOf getting index of array element, returns -1 if not found var colors=["red","green","blue"]; var pos=colors.indexOf("blue");//2 //indexOf getting index of sub string, returns -1 if not found var str = "... Add solution -
-
Javascript 2021-10-21 16:49:09
javascript get all characters before a certain one
// say you wanted to collect all the chars before a slash (/). myString = "12345.67890"; newString = myString.substring(0, myString.indexOf('/')); console.log(newString); // returns "12345" Add solution
Best helpers
Ranking is empty