I and my students have been seeing some strange behavior when testing their classmates’ libraries.
Let’s say Stacy imports Michael’s library, called MathStuff. Stacy tests some functions with her own console.log statements. What she sees in the console is the result of every console.log statement in the MathStuff library. Do students need to delete all the console.log statements before sharing their library?
Also, let’s say Stacy then imports Amanda’s library, called ListFunctions, but hasn’t removed the MathStuff library. Stacy deletes her console.log statements testing MathStuff, and writes new console.log statements testing ListFunctions. When she runs the program, all the console.log tests in MathStuff still show up in Stacy’s console, in addition to all console.log statements in ListFunctions. Even when she runs a completely blank program, she still gets output in the console from the console.log statements in both the libraries.
Is this a bug, or is there some way around this?