You need Login/Signup to run/submit the code.
In this question, you need to implement a
tuple function that takes a
string as input and converts it into a
array of arrays. The
tuple should support a function
multiply that multiples
ith item of each nested array.
const item = tuple(input); item.multiply(position);
input (String): the string that we need to convert
const input = `(1, 2, 3) , (4, 5, 6) , (7, 8, 9)`; // Convert it into // [[1, 2, 3], [4, 5, 6], [7, 8, 9]] const item = tuple(input); // Multiples 2nd item in each nested array // i.e. 2 * 5 * 8 = 80 console.log(item.multiply(2));
multiply should exist on the return value of the
tuple function. You can either directly set it on the return value or on the Array prototype.
Start the timer, complete your solution, test your solution against the test cases provided by the platform, and submit it. Ideally, you should finish this question within 30 mins.