I'm attempting the following:  var a1 = ['a', 'e', 'f'];  // [a, e, f] var a2 = ['b', 'c', 'd'];  // [b, c, d] a1.splice(1, 0, a2);       // expected [a, b, c, d, e, f]                            //...
In the CoffeeScript docs for array splicing, what is the purpose of the trailing , _ref?  CoffeeScript:  numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] numbers[3..6] = [-3, -4, -5, -6]   Compiles to:  var numbers, _ref; numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8...
I've been working for a while on this function but i cannot figure out why even if I'm using .splice() I don't get a modified array. I'm providing the index at which to start changing the array "i", the number of elements to r...
I am using CoffeeScript along with the JS splice function.  My understanding of the JS splice function is that it should return the objects that were spliced out and modify the original array.  This seems to work ok with simple arrays but when I star...
I have an array which looks like:-  [[0,1], [0,2], [0,3], [1,1], [1,2]...]   I am looking to remove one of the arrays from this array based on the indexOf() but I keep getting a value of -1, which removes the last item from the array when I try the f...
Why below array is not being removed.   var removeableIndex =-1;         bookingStatus.bookings.filter(function(item, index) {             if(item.id == id){                 removeableIndex = index;                 return true;             }...
Did a project in coding school a while back in JS where we were using the Sieve of Eratosthenes (I can't not read in that in some kind of booming, echoey voice) to output all the prime numbers up to a user inputted number.  The code we came up wi...
I need to delete a subarray if it has a particular element.  function filteredArray(arr, elem) {   let newArr = [];   for (let i = 0; i < arr.length; i++){     for (let j = 0; j < arr[i].length; j++) {       if (arr[i][j] === elem) {         ar...
So I have the following array:  var hdr = ("name", "date", "start_time", "selling_item", "total_call",             "end_time", "ad_num", "area", "order_num"); //this data is retu...
Good day!  I'm currently working on manipulating my Array by adding objects at index 0 using the push method and removing items using the splice method. As I've read and understood, when you splice an item from an array, it does not leave the...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.