From a070e4c0a99efdbcdbfe81f2258ad546e54bd7e8 Mon Sep 17 00:00:00 2001 From: Karan Singh Date: Thu, 2 Nov 2023 15:38:13 -0700 Subject: [PATCH] Create test.js --- test.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test.js diff --git a/test.js b/test.js new file mode 100644 index 0000000..e0d30c3 --- /dev/null +++ b/test.js @@ -0,0 +1,23 @@ +// Example JavaScript program with intentional errors + +// Error 1: Missing semicolon +let greeting = "Hello, World!" +console.log(greeting) + +// Error 2: Undefined variable +console.log(someUndefinedVariable) + +// Error 3: Invalid function call +function sayHello(name) { + console.log("Hello, " + name) +} + +sayHello("Alice") + +// Error 4: Using const and trying to reassign a value +const number = 42 +number = 100 + +// Error 5: Typo in the variable name +let message = "This is a message" +console.log(mesage)