WEB PROGRAMMING | HTML document demonstrates basic JavaScript functionality | SNS INSTITUTIONS
This HTML document demonstrates basic JavaScript functionality embedded directly within a webpage using script` tags. Inside the script section, three variables are declared using `var`, `let`, and `const` to illustrate different ways of defining variables in JavaScript. The variable `name` is a string, `age` is a number, and `isStudent` is a boolean. These variables are assigned values and displayed using `console.log()`, which helps developers verify outputs in the browser’s developer console. An `alert()` function is used to display a pop-up message combining the values of the variables, providing a simple way to interact with users. The `prompt()` function is implemented to request input from the user, specifically asking for their name. The entered value is stored in a variable and logged to the console for verification. Additionally, the `confirm()` function is used to ask a yes/no question. It returns a boolean value (`true` for OK and `false` for Cancel), which is then logged to the console. Finally, a summary object containing all collected and predefined values is printed to the console, giving a structured overview of the interactions. This example helps beginners understand variable types, user interaction methods, and debugging using the console. #snsinstitutions #snsdesignthinkers #designthinking
Download
0 formatsNo download links available.