I am going around in circles and struggling to find a solution; any education/guidance would really help me.
I may have a lot of arrays which I am doing string manipulation on.
I created a helpful debug function, to help me print the length of the elements in the arrays; post string manipulation.
This is the single array function, its working; however I'd like to use rest operators, as I'd like to feed it alot of arrays as parameters:
let arr1 = ["one", "two", "three"];
let arr2 = ["four", "five", "six"];
function debug_qty(arr) {
let post_arr_filter = arr.map(function(word) {
return `${word.length}`;
});
return post_arr_filter;
};
I have tried the below - but it only prints the first array, and when I append .length, I get 3, instead of 3,3,5 (the length of the individual strings).
let arr1 = ["one", "two", "three"];
let arr2 = ["four", "five", "six"];
function check_length(...args) {
for (let arrs in args) {
return args[arrs].length;
};
};
My next attempt - this seems to find the two array lengths(i think), again not the child elements.
function calc_arr(...args) {
let result = args.map(function(nums) {
return nums.length;
});
return result;
}
I am going around in circles, so any mentoring would be most helpful. :)