UNPKG

same.js

Version:

A Class of Parallel Arrays Manipulation

12 lines (10 loc) 645 B
const {Same} = require("Same"); var same = new Same(); async function main() { let ar1 = [0, 1, 2, 3]; // creates a 4-indexed array let ar2 = ["zero", "one", "two"]; // creates a 3-indexed array same.insert(ar1, ar2); // inserts the arrays in the Same; since ar2 has one value less than ar1, in the second array there will be an empty space await same.replaceUnd(["three"]) // the empty space is overwritten with the string "three" console.log(same); } main() // calls the async function (THE MODULE replaceUnd() MUST BE AWAITED)