ERRORs IN JS

  1. carbon (1).png Output: Reference error. As age not found.

2.

  • map() is used when we want to output in terms array. return is used.
  • forEach() is used when we want output line by line. console.log() is used.

3.

  • carbon (2).png

This will give UndefinedOutput. As the return is used in a forEach callback function.

  • The correct way of writing the above code is

carbon (3).png Console.log is used instead of return.

-

If inside callback function argument is not passed. It will give REFERENCE ERROR as value not found.

4.

-

Run Time Error if matrix[]3x3 is there and we do console.log(arr[2][4]). It will give Exception error Out of bound spaces as this memory is not allocated.