+ 2
What do these functions do:
eval() catch(e) push()
2 Answers
+ 2
Method eval() gets parameter as a string and just runs code so I suppose you have not really to use it.
try - catch is a construction.
Code stores in block try runs however if it has an error, block catch runs. Parameter e(exception) uses as a processing an error.
Example:
try {
alert('Hello');
} catch (exception) {
console.log(exception);
}
Push is a method to push an item into an array.
Also known as Array.prototype.push.
Example:
let myArray = [];
myArray.push('myValue');
console.log(myArray[0]); // myValue
+ 1
Thanks a lot Sergey Vishnevsky đđ