danielpybus
Coder
Hi all, please note I am very much a beginner lol. And I have run into a bit of a snag.
var stockBlock = ['abc', 123, 500, 500, 2000];
var jobBlock = ['def', 123, 100, 100, 300];
I have these two arrays in my javascript. I want to subtract one value of jobBlock (index 4 - 300) from index 4 of stockBlock (2000) and create a new array as follows:
var residueBlock = [ghi, 123, 500, 500, 1700];
But I have no idea how. I have tried using .splice, but all that does is display the removed element (2000). I really am very lost. Any guidance would be greatly appreciated.
Thank You
var stockBlock = ['abc', 123, 500, 500, 2000];
var jobBlock = ['def', 123, 100, 100, 300];
I have these two arrays in my javascript. I want to subtract one value of jobBlock (index 4 - 300) from index 4 of stockBlock (2000) and create a new array as follows:
var residueBlock = [ghi, 123, 500, 500, 1700];
But I have no idea how. I have tried using .splice, but all that does is display the removed element (2000). I really am very lost. Any guidance would be greatly appreciated.
Thank You