Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (31 sloc) 692 Bytes
  1. A nested function that prints a stack trace error to the console

function firstFunction(){
throw new Error('Stack Trace Error');
}

function secondFunction(){
firstFunction();
}

function thirdFunction(){
secondFunction();
}

thirdFunction();


  1. A function that calls another function to show how the stack handles multiple function calls.

function firstFunction(){
 console.log("Hello from firstFunction");
}

function secondFunction(){
 firstFunction();
 console.log("The end from secondFunction");
}

secondFunction();

  1. A recursive function that will throw a maxiumu call stack error.
function callMyself(){
  callMyself();
}

callMyself();

You can’t perform that action at this time.