Javascript: Make independent copy of array using slice() method

Sometime it happens that we need to make copy of an array but in javascript when we assign an array to new it assign it with reference means if you delete anything from new array it will delete it from the main array as well 🙁

To create a copy of an array that is independent of another array:
Use the Array object’s slice() method.

For example, the following statements create an array and then use slice() to make an independent copy of the array.

 // JavaScript syntax

var oldArray = ["1", "b", "3"];

var newArray = oldArray.slice();

HSQLDB : java.sql.SQLException: User not found: SA

While running HSQLDB in standalone mode you may face the error

  java.sql.SQLException: User not found: SA

This is because while creating the DB using script file you are not creating the user


The above command you have to include in your db.script file db is your database name) this will creates a user by name SA with blank password.