Computer Science, asked by Shubhjot6632, 10 months ago

What is the purpose of document.write() in JavaScript code?

Answers

Answered by praachinayak
4

Explanation:

The write() method writes HTML expressions or JavaScript code to a document.

The write() method is mostly used for testing: If it is used after an HTML document is fully loaded, it will delete all existing HTML.

When this method is not used for testing, it is often used to write some text to an output stream opened by the document.open() method.

Answered by shilpa85475
1

Writes HTML or JavaScript in a document by write ().  

Explanation:

  • Writes HTML or JavaScript codes in a document using the write () process. The write () method is usually used to test: When used after a complete loading of the HTML document, all existing HTML s are deleted.
  • The write () technique is used mostly for testing: if it is used after a fully loaded HTML document, all current HTML will be removed. Note:

When not used for testing, this method is often used to write any text to a document.open () function output stream. See the following "More Examples."

Tip:

The.written() document is like write () only, after every statement, adds the newline character.

Similar questions