VANILLA JS or JAVASCRIPT
The term vanilla script is used to refer to the pure JavaScript (or we can say plain JavaScript) without any type of additional library.JS is a dynamic programming language that supports Math calculations, allows you to dynamically add HTML contents to the DOM, creates dynamic style declarations, fetches contents from another website, add functionality to the website and lots more.There are many ways of using JS in clients but the most common and simple are`:
-
"alert" - The alert() method in JavaScript is used to display a virtual alert box. It is mostly used to give a warning message to the users. It displays an alert dialog box that consists of some specified message (which is optional) and an OK button.
-
"prompt" - The prompt() method is used to display a dialog with an optional message prompting the user to input some text. It is often used if the user wants to input a value before entering a page. It returns a string containing the text entered by the user, or null. Syntax: prompt(message, default).
-
console.log() - The console. log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. Syntax: console. log("message");
The elements which I used in the assignment are defined below:
-
BUTTON
The button object in HTML is used to represent a <button> element. The getElementById() method is used to get the button object. Creating button object: The button object can be created using JavaScript.
-
addEventListener
The addEventListener() is an inbuilt function in JavaScript which takes the event to listen for, and a second argument to be called whenever the described event gets fired. Any number of event handlers can be added to a single element without overwriting existing event handlers.
-
CALL BACK FUNCTION
The call() method is a predefined JavaScript method. It can be used to invoke (call) a method with an owner object as an argument (parameter). With call() , an object can use a method belonging to another object.
-
TEXTAREA
The <textarea> tag defines a multi-line text input control.A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier). The size of a text area is specified by the <cols> and <rows> attributes (or with CSS).
-
querySelector()
The querySelector() method only returns the first element that matches the specified selectors. To return all the matches, use the querySelectorAll() method instead.
-
API
An application programming interface(api) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software.In other words,it allow two application to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you're using an API.
-
URL
The location of a webpage or file on the Internet. Just as buildings and houses have a street address, webpages also have unique addresses to help people locate them.On the Internet, these addresses are called URLs (Uniform Resource Locators).
-
fetch()
Fetch is the retrieval of data by a software program, script, or hardware device. After being retrieved, the data is moved to an alternate location or displayed on a screen.
-
JSON
JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).