js clone node code example

Example 1: promp node js

const readline = require("readline");

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question("What is your name ? ", function saveInput(name) {
  console.log(`His name is ${name}`);
  rl.close();
});

rl.on("close", function saveInput() {
    console.log("\nBYE BYE !!!");
    process.exit(0);
});

Example 2: js clone element

// Syntax:
let newClone = node.cloneNode([deep])

// Example:
let p = document.getElementById("para1")
let p_prime = p.cloneNode(true)