Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Manipulating Local Variables</title> </head> <body> <script> function makeCounter() { // Local variable var counter = 0; // Manipulating the 'counter' variable return counter += 1; } // Calling the function document.write(makeCounter() + "<br>"); // Prints: 1 document.write(makeCounter()); // Prints: 1 </script> </body> </html>