1. Console.log
Example:
console.log("print log")
This is going to output 'print log' on your console. So, basically, it takes a parameter, and outputs that parameter to the console. It is often used by developers for debugging. They can log useful information using this javascript function that helps them to debug their code.

2. document.write()
Example:
document.write("<p> Adding a paragraph using document.write() </p>")
has the capability to add to the HTML using javascript. In this case, it adds a new paragraph element to the html. Hence, document.write() modifies the DOM, but console.log does not.

3. alert()
Example:
alert("Hi!! This is an alert message")
alert is a pop-up message window that appears on the browser window. The appearance of the browser window is specific to a browser. It may also be sometimes used for detecting small errors that occur in javascript by putting an alert window at steps that may be causing error. This, however is not of much help. Alert can be used for passing message to the user.

explain differences for alert, console.log, document.write illustrate with examples Javascript Html
Notepad++ JavaScript Create an HTML file, using XHTML. Add JavaScript scripts to the file. Create 3 variables to hold the famous quote (NOTHING BUT THE QUOTE). My code so far. var firstQuote = "Give me a museum and I'll fill it." // I am stuck on the document.write part. How can i display it? document.write("1. Pablo Picasso says: "+firstQuote");
Javascript - Html - css write a function to get two parameters a and b and returns a floating point random number between the two. You cannot assume a is always less than b. you need to do some checking. invoke that function multiple times in console.log to test and display the result console.log(generateRandom(4,1)); console.log(generateRandom(4,1)); console.log(generateRandom(-9,10));
//--------// // Events // //--------// console.log("Events"); // 1. Change the link (the <a> tag) in the HTML body below such that a hello // message is displayed on a click event. //--------------// // Input Fields // //--------------// console.log("Input Fields"); // 1. Change the background color to red for the input text field (the <input> // tag) in the HTML body when obtaining the focus and change it back to // white when the focus is lost. // 2. Read the...
WEBPROG. 9. Research the JavaScript string object, and discuss the capabilities it provides. Include examples of the object’s use. 10. Create an HTML file that creates a dog object that includes a breed, name, and age. Assign values to the object, and then use an alert dialog box to display each field’s value.
What is the problem with this code? <html> <body> <script type="text/javascript"> //Declare variables var numStudents; var index; var sName; var ES = ""; var BR = "<br />"; var PA = "<p />"; //Print statement document.write("Student Name Entry Program" + PA); //Prompt for number of students to add numStudents = prompt("Enter the number of student names to add: "+ ES); //Loop through numStudents of times, prompting for student names for(index = 1; index <= numStudents: index++) { sName = prompt("Enter...
This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" /> </head> <body> <script type ="text/javascript"> //declare a variable and store text in it var x = "JavaScript is fun"; //write the variable 5 times document.write(x + x + x + x + x); //store 5 as string in variable x x = "5"; //store 3 as string in variable y var y = "3"; //write the value x + y to the document document.write("<br>");...
HTML------------------------------------------------------CSS---------------------------------------------------WEB230 - JavaScript 1 Assignment 7 - FormsSome of these tasks would be better done in HTML or CSS but do them in JavaScript to practice whatwe have learned.1. Select the form element and save it in a variable. From here we can access all of the form fields.2. When the page loads do the following:add the password value "monkey"select the favourite city "New York"clear the textarea3. Add an event handler to the "name" field to change the background color...
So in order to make this Javascript work in html ... do i need to make a ?? How should I call it in html. function main() { var x = Number(prompt("Enter a number")); var y = Number(prompt("Enter another number")); output = "The sum of " + x + " and " + y + " is: " + (x + y); output += "\nThe product of " + x + " and " + y + " is: "...
Javascript + HTML, no JQuery please. So, Im trying to figure out how to send an alert if the value of my selection is "0". I will be using this for a validation form assignement. So if the user leaves the selection on the default "0" value I can prompt the user to pick a valid option which would be 1+. Not sure how to access this value. Example code below: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Form Validation</title>...