same.js
Version:
A Class of Parallel Arrays Manipulation
15 lines (12 loc) • 708 B
JavaScript
const { Same } = require("Same");
var same = new Same();
for (let i = 0; i < 10; i++) {
same.insert(i, i - i * 2); // inserts in the first array every number from 0 to 9 and in the second array every number from 0 to -9
}
same.insert("hello", "ciao") // inserts in the first array the string "hello" and in the second array the string "ciao"
console.log(same);
console.log("\n\n\n");
same.remove(0); // removes the indexes 0 for both arrays
same.remove("hello") // removes the indexes of the value "hello" for both arrays
same.remove([1, 3, 5, 7, 9], false) // removes every odd number from the arrays
console.log(same);