+ 2

What do these functions do:

eval() catch(e) push()

20th Apr 2018, 4:09 PM
scientist
scientist - avatar
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
20th Apr 2018, 5:00 PM
Sergey Vishnevsky
Sergey Vishnevsky - avatar
+ 1
Thanks a lot Sergey Vishnevsky 😃😃
20th Apr 2018, 5:09 PM
scientist
scientist - avatar