- JavaScript Introduction
- JavaScript Where To
- JavaScript Output
- JavaScript Statements
- JavaScript Syntax
- JavaScript Comments
- JavaScript Variables
- JavaScript Let
- JavaScript Const
- JavaScript Operators
- JavaScript Assignment
- JavaScript Data Types
- JavaScript Functions
- JavaScript Objects
- JavaScript Events
- JavaScript Strings
- JavaScript String Methods
- JavaScript Numbers
- JavaScript Number Methods
- JavaScript Arrays
- JavaScript Array Const
- JavaScript Array Methods
- JavaScript Sorting Arrays
- JavaScript Array Iteration
- JavaScript Date Objects
- JavaScript Date Formats
- JavaScript Get Date Methods
- JavaScript Set Date Methods
- JavaScript Math Object
- JavaScript Random
- JavaScript Booleans
- JavaScript Comparison And Logical Operators
- JavaScript If Else And Else If
- JavaScript Switch Statement
- JavaScript For Loop
- JavaScript Break And Continue
- JavaScript Type Conversion
- JavaScript Bitwise Operations
- JavaScript Regular Expressions
- JavaScript Errors
- JavaScript Scope
- JavaScript Hoisting
- JavaScript Use Strict
- The JavaScript This Keyword
- JavaScript Arrow Function
- JavaScript Classes
- JavaScript JSON
- JavaScript Debugging
- JavaScript Style Guide
- JavaScript Common Mistakes
- JavaScript Performance
- JavaScript Reserved Words
- JavaScript Versions
- JavaScript History
- JavaScript Forms
- JavaScript Validation API
- JavaScript Objects
- JavaScript Object Properties
- JavaScript Function Definitions
- JavaScript Function Parameters
- JavaScript Function Invocation
- JavaScript Closures
- JavaScript Classes
- Java Script Async
- JavaScript HTML DOM
- The Browser Object Model
- JS Ajax
- JavaScript JSON
- JavaScript Web APIs
- JS Vs JQuery
JavaScript Where To
The Script Tag
Syntax of the <script>
Tag
The basic syntax of the <script>
tag is as follows:
// JavaScript code goes here
</script>
You can also include the type attribute to specify the scripting language. Although it's not required for JavaScript (as it's the default scripting language for web browsers), it can be helpful for clarity and compatibility:
// JavaScript code goes here
</script>
Purpose of the
<script>
Tag
The primary purpose of the <script>
tag is to include executable code within an HTML document. This code can manipulate the document's structure, style, behavior, and interactions with users. JavaScript code inside <script>
tags can perform a wide range of tasks, such as validating form inputs, creating animations, handling events, making AJAX requests, and much more.
Placement of
<script>
Tags
You can place <script>
tags in different locations within an HTML document:
Inside the <head>
section: Scripts placed here are loaded before the document content, allowing them to initialize variables, set configurations, or load external resources before the page is fully rendered. However, they may delay the rendering process.
<script>
// JavaScript code for initialization
</script>
</head>
Inside the <body>
section (at the end): Placing scripts at the end of the <body> tag ensures that the HTML content is loaded first, improving page load performance. This is commonly recommended for scripts that manipulate or interact with the document's content.
<body>
<!-- HTML content -->
<script>
// JavaScript code for interacting with HTML content
</script>
</body>
External JavaScript files: Instead of embedding JavaScript directly in HTML, you can create separate .js files and include them using the <script>
tag's src attribute. This promotes code reusability, maintainability, and separation of concerns.
Attributes of the
<script>
Tag
The <script>
tag supports several attributes that modify its behavior:
- src: Specifies the URL of an external JavaScript file to include.
- type: Specifies the scripting language (e.g., text/javascript, application/javascript). In modern HTML, this attribute is optional for JavaScript.
- async: Indicates that the script should be executed asynchronously, allowing it to load in parallel with other resources.
- defer: Delays script execution until after the document is parsed, maintaining the script's order while not blocking page rendering.
Examples of <script> Tag Usage
Inline JavaScript:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Script Tag Example</title>
</head>
<body>
<h1>Hello, world!</h1>
<script>
alert('This is an inline script');
</script>
</body>
</html>
In this example, an inline <script>
tag is used to display an alert message when the page is loaded.
External JavaScript File:
Create a file named script.js with the following content:
console.log('External JavaScript file loaded');
Then, include this file in an HTML document:
html
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External Script Example</title>
<script src="script.js"></script>
</head>
<body>
<h1>Hello, world!</h1>699+
</body>
</html>
When the above HTML page is opened in a browser, it will log a message to the console indicating that the external JavaScript file has been loaded.
Best Practices for Using
<script>
Tags
- Separate Behavior from Structure: Keep JavaScript code separate from HTML structure whenever possible. Use external files for complex scripts.
- Place Scripts at the End: For better performance, place scripts at the end of the
<body>
tag, especially for scripts that don't need to run immediately. - Use defer or async Attributes: When including scripts in the
<head>
section, consider using defer or async attributes to control script loading behavior. - Avoid Inline Styles: Minimize the use of inline JavaScript code within HTML attributes (onclick, onload, etc.) for better maintainability and readability.
Practice Excercise Practice now
JavaScript Functions And Events
JavaScript Functions and Events Explained
Functions and events are essential concepts in JavaScript that enable developers to create interactive and dynamic web pages. In this comprehensive guide, we will delve into JavaScript functions, how they work, different types of functions, and how events are used to trigger actions in response to user interactions. Throughout the discussion, we'll provide examples to illustrate these concepts
JavaScript Functions
What are Functions?
Functions in JavaScript are blocks of reusable code that perform specific tasks when called. They allow developers to encapsulate logic into named blocks, making code more modular, organized, and easier to maintain. Functions can take inputs (parameters) and return outputs (values).
Syntax of a Function
The syntax for creating a function in JavaScript is as follows:
// Code block or statements
return result; // Optional return statement
}
- functionName: The name of the function, which can be used to call it later.
- parameter1, parameter2: Parameters are optional, and a function can have zero or more parameters.
- return result: The optional return statement is used to return a value from the function.
Example of a Function
Let's create a simple function that calculates the area of a rectangle:
unction calculateArea(length, width) {
let area = length * width;
return area;
}
let rectangleArea = calculateArea(5, 10);
console.log('Area of rectangle:', rectangleArea); // Output: Area of rectangle: 50
In this example:
We define a function calculateArea that takes length and width as parameters.
Inside the function, we calculate the area using the formula length * width.
We call the function calculateArea(5, 10) and store the returned value in rectangleArea.
Finally, we log the calculated area to the console.
Types of JavaScript Functions
Named Functions:
function sayHello(name) {
return `Hello, ${name}!`;
}
Anonymous Functions (assigned to variables or passed as arguments):
javascript
Copy code
let addNumbers = function(a, b) {
return a + b;
};
Arrow Functions (ES6 syntax for shorter function definitions):
let multiplyNumbers = (a, b) => a * b;
Immediately Invoked Function Expressions (IIFE):
javascript
Copy code
(function() {
console.log('This is an IIFE');
})();
JavaScript Events
What are Events?
Events in JavaScript are actions or occurrences that happen in the browser. They can be triggered by user interactions (like clicking a button, typing in an input field, etc.) or by the browser itself (like page load, window resize, etc.). JavaScript allows developers to attach event handlers to elements, defining what should happen when specific events occur.
Common JavaScript Events
Click Event:
Input Event:
Mouse Events (mouseover, mouseout, mousemove, etc.):
<div onmouseover="console.log('Mouse over')">Hover me</div>
Form Events (submit, reset, etc.):
<form onsubmit="alert('Form submitted')">...</form>
Adding Event Listeners
Event listeners are functions that wait for specific events to occur and then execute a block of code. They offer a more flexible and recommended approach for handling events compared to inline event handlers.
alert('Button clicked');
});
In this example, we add a click event listener to a button with the ID myButton. When the button is clicked, the anonymous function inside the addEventListener method is executed, showing an alert.
Example: Handling Form Submission
Let's create a simple HTML form and use JavaScript to handle its submission event:
<form id="myForm">
<label for="name">Name:</label>
<input type="text" id="name">
<button type="submit">Submit</button>
</form>
document.getElementById('myForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent default form submission behavior
let name = document.getElementById('name').value;
alert(`Hello, ${name}! Form submitted.`);
});
In this example:
- We add a submit event listener to the form.
- The event.preventDefault() prevents the default form submission behavior, allowing us to handle the submission manually.
- We retrieve the input value from the form and display a personalized greeting message using an alert.
Practice Excercise Practice now
JavaScript In Head Or Body
JavaScript in the <head>
Section
Early Execution:
Placing JavaScript in the <head> section means it gets executed before the rest of the page loads. This is beneficial for scripts that need to run early, such as initializing variables or setting up configurations.
<!DOCTYPE html>
<html>
<head>
<script>
// Initialize variables
let message = "Hello, world!";
</script>
<title>JavaScript Placement</title>
</head>
<body>
<h1>JavaScript Placement</h1>
<p id="output"></p>
<script>
// Access variables and manipulate DOM
document.getElementById("output").textContent = message;
</script>
</body>
</html>
Blocking Rendering:
The downside is that JavaScript in the <head> can block rendering of the page until the script has fully loaded and executed. This can lead to a delay in displaying content to the user.
Global Scope:
Variables and functions declared in the <head> section have a global scope by default. This means they can be accessed from anywhere in the document, including other scripts and DOM manipulation.
External Scripts:
External JavaScript files (<script src="filename.js"></script>) linked in the <head> section are also loaded and executed before the page content, which can impact page load times.
JavaScript in the
<body>
SectionDeferred Execution:
Placing JavaScript at the end of the <body> section ensures that it executes after the HTML content has been parsed and displayed. This can improve perceived page load speed as the content appears faster.
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Placement</title>
</head>
<body>
<h1>JavaScript Placement</h1>
<p id="output"></p>
<script>
// Initialize variables and manipulate DOM
let message = "Hello, world!";
document.getElementById("output").textContent = message;
</script>
</body>
</html>
Non-blocking Rendering:
By placing JavaScript at the end of the <body>, it doesn't block the rendering of the page's main content. Users see the page structure and initial content faster, even if interactive features load later.
Local Scope:
Variables and functions declared in scripts within the <body> section have a more limited scope, usually confined to that script block. This can reduce namespace pollution and potential conflicts.
Asynchronous Loading:
<script src="filename.js" async></script>
or <script src="filename.js" defer></script>
) allows them to load asynchronously or defer execution, respectively, further improving page load performance.Best Practices and Use Cases
Critical Scripts: Essential scripts like analytics or critical functionality initialization are often placed in the <head>
for early execution.
Non-Critical Scripts: Scripts that enhance user experience but aren't immediately necessary for page functionality can be placed at the end of the <body> for faster initial rendering.
Performance Optimization: Utilize techniques like lazy loading or asynchronous loading for non-critical scripts to prioritize content delivery.
Modularization: Break down JavaScript code into smaller modules and load them strategically based on dependencies and functionality requirements.
Progressive Enhancement: Design pages to function without JavaScript initially and progressively enhance with JavaScript for users with compatible environments.
Example: Progressive Enhancement
Consider a webpage for a blog. The core content, such as article text and images, is loaded initially, allowing users to start reading immediately. JavaScript enhances the experience by adding interactive features like comments, search functionality, and dynamic content updates.
<!DOCTYPE html>
<html>
<head>
<title>Blog Example</title>
</head>
<body>
<header>
<h1>Welcome to the Blog</h1>
</header>
<article>
<h2>Article Title</h2>
<p>Article content goes here...</p>
</article>
<footer>
<p>Copyright © 2024 BlogName. All rights reserved.</p>
</footer>
<!-- Non-critical JavaScript for enhancing user experience -->
<script src="comments.js" defer></script>
<script src="search.js" defer></script>
<!-- Other scripts for dynamic content, analytics, etc. -->
</body>
</html>
In this example, the <body>
section focuses on delivering the core content, while JavaScript scripts at the end enhance the user experience without delaying initial page rendering.
Understanding when to place JavaScript in the <head> or <body> is crucial for optimizing performance, ensuring functionality, and enhancing user experience on web pages.
Practice Excercise Practice now
External JavaScript
Benefits of External JavaScript Files
1.Code Organization:
- External JavaScript files allow developers to organize their codebase more efficiently. Instead of cluttering HTML files with scripts, separate files can be created for different functionalities, making it easier to manage and maintain.
2.Reusability:
- Code stored in external JavaScript files can be reused across multiple HTML pages. This promotes a modular approach to development, where common functionalities or libraries can be included wherever needed without duplicating code.
3.Ease of Maintenance:
- Since JavaScript code is separated from HTML, updates and modifications become more manageable. Developers can focus on editing the JavaScript file without impacting the HTML structure, reducing the chances of introducing errors.
Caching Benefits:
- External JavaScript files are cached by the browser after the initial download. Subsequent requests for the same file are served from the cache, leading to faster load times and reduced server load.
How to Use External JavaScript Files
1.Creating an External JavaScript File:
- Create a new text file with a .js extension, such as script.js.
- Write your JavaScript code within this file, following best practices for readability and maintainability.
function greetUser(name) {
alert("Hello, " + name + "!");
}
2.Linking External JavaScript File to HTML:
In your HTML document, use the <script>
tag to link the external JavaScript file.
Place this <script>
tag either in the <head>
or <body>
section, depending on your requirements.
<!DOCTYPE html>
<html>
<head>
<title>External JavaScript Example</title>
<script src="script.js"></script>
</head>
<body>
<h1>Welcome</h1>
<button onclick="greetUser('John')">Click me</button>
</body>
</html>
3.Using Functions from External File:
- Functions and variables defined in the external JavaScript file can be accessed and used within the HTML document.
Example Scenario: Greeting Function
Let's consider a simple example where we have an external JavaScript file greetings.js containing a function to greet users.
greetings.js (External JavaScript File)
function greetUser(name) {
alert("Hello, " + name + "!");
}
HTML Document
<!DOCTYPE html>
<html>
<head>
<title>Greetings</title>
<script src="greetings.js"></script>
</head>
<body>
<h1>Welcome</h1>
<button onclick="greetUser('Alice')">Greet Alice</button>
<button onclick="greetUser('Bob')">Greet Bob</button>
</body>
</html>
In this example, the greetUser function defined in greetings.js is linked to the HTML document using <script src="greetings.js"></script>
. When the buttons are clicked, the corresponding names are passed to the greetUser function, which displays a greeting message using alert.
Best Practices for External JavaScript Files
1.Use Descriptive Names:
- Choose meaningful names for external JavaScript files to convey their purpose or functionality, improving code readability.
2.Minification and Compression:
- Minify and compress external JavaScript files before deployment to reduce file size and improve load times.
3.Separation of Concerns:
- Keep JavaScript code focused on specific functionalities to maintain a clear separation of concerns. Avoid mixing HTML and JavaScript logic excessively.
4.Error Handling:
- Implement error handling mechanisms such as try-catch blocks or error logging to manage and debug issues in external JavaScript files effectively.
5.Version Control:
- Use version control systems (e.g., Git) to track changes and collaborate on external JavaScript files within a team environment.
Considerations and Limitations
1.Browser Compatibility:
Ensure that external JavaScript files are compatible with different browsers and handle any browser-specific quirks or differences.
2.Network Dependency:
External JavaScript files rely on network availability for loading. Consider fallback mechanisms or offline strategies for improved reliability.
3.Security Concerns:
Be cautious of security vulnerabilities such as Cross-Site Scripting (XSS) when including external JavaScript files, and implement measures to mitigate risks.
4.Performance Optimization:
Optimize external JavaScript files for performance by reducing unnecessary code, leveraging caching strategies, and minimizing dependencies.
Practice Excercise Practice now
External JavaScript Advantages
Advantages of Using External JavaScript
JavaScript is a versatile programming language that allows developers to create dynamic and interactive web applications. While JavaScript code can be embedded directly within HTML documents, using external JavaScript files offers numerous benefits. In this discussion, we will explore the advantages of external JavaScript, supported by examples and detailed explanations.
1. Separation of Concerns
Definition: Separation of concerns is a design principle for separating a computer program into distinct sections, such that each section addresses a separate concern.
Explanation: By placing JavaScript in external files, the HTML document focuses solely on structure and content, while the external JavaScript file handles behavior. This makes the code more modular and easier to manage.
Example:
<!DOCTYPE html>
<html>
<head>
<title>External JavaScript Example</title>
<script src="script.js"></script>
</head>
<body>
<h1 id="greeting">Hello, World!</h1>
<button onclick="changeGreeting()">Change Greeting</button>
</body>
</html>
In this example, the HTML document remains clean and focused on structure, while the JavaScript file handles the interactive behavior.
2. Code Reusability
Definition: Code reusability refers to the use of existing code in new applications, minimizing redundancy and development effort.
Explanation: External JavaScript files can be reused across multiple HTML pages. This is especially useful for large web applications where the same functionality is required on different pages.
Example:
<!-- Page 1 -->
<!DOCTYPE html>
<html>
<head>
<title>Page 1</title>
<script src="common.js"></script>
</head>
<body>
<button onclick="showAlert()">Show Alert</button>
</body>
</html>
3. Improved Maintainability
Definition: Maintainability refers to the ease with which a software system or component can be modified to correct faults, improve performance, or adapt to a changed environment.
Explanation: When JavaScript is separated into external files, it becomes easier to update and maintain. Changes to the JavaScript code need to be made in one place only, rather than across multiple HTML files.
Example:
Suppose you need to update a function that is used across several pages. With embedded JavaScript, you would have to update each HTML file individually. With an external file, you only update the external JavaScript file.
// script.js
function showMessage() {
console.log('Updated message!');
}
Updating the showMessage function in the external file ensures all pages using this script get the updated message automatically.
4. Reduced HTML File Size
Definition: Reducing HTML file size improves the loading time of web pages by minimizing the amount of data transferred from the server to the client.
Explanation: Embedding JavaScript code directly within HTML can significantly increase the file size. By moving JavaScript to an external file, the HTML remains lightweight, which can enhance page load performance.
Example:
<!-- Without external JavaScript -->
<!DOCTYPE html>
<html>
<head>
<title>Inline JavaScript</title>
</head>
<body>
<h1>Click the button to see a message</h1>
<button onclick="document.getElementById('message').innerText = 'Hello, World!'">Click Me</button>
<p id="message"></p>
<script>
function showMessage() {
document.getElementById('message').innerText = 'Hello, World!';
}
</script>
</body>
</html>
The HTML file size is reduced by moving the JavaScript to an external file, leading to faster load times.
5. Browser Caching
Definition: Browser caching allows frequently accessed resources to be stored on the client side, reducing load times for subsequent requests.
Explanation: External JavaScript files can be cached by the browser, meaning they don't need to be re-downloaded every time the page is loaded. This can significantly improve the performance of web applications.
Example:
When a user visits multiple pages on a website that all use the same external JavaScript file, the browser will cache this file after the first download. Subsequent page loads will be faster as the cached file is used.
6. Better Collaboration
Definition: Collaboration in software development involves multiple developers working together to build and maintain code.
Explanation: External JavaScript files facilitate better collaboration among developers by allowing them to work on separate files. This can improve the efficiency of the development process, as different team members can focus on different aspects of the project without interfering with each other's work.
Example:
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>Collaboration Example</title>
<script src="ui.js"></script>
<script src="data.js"></script>
</head>
<body>
<h1>Team Collaboration Example</h1>
<button onclick="loadData()">Load Data</button>
<div id="data-container"></div>
</body>
</html>
In this example, one developer can work on ui.js (handling the user interface), while another works on data.js (handling data fetching and processing). This separation makes collaboration easier.
7. Enhanced Security
Definition: Security in web development involves protecting data and resources from unauthorized access and threats.
Explanation: Using external JavaScript files can enhance security by separating executable code from the HTML content. This makes it harder for attackers to inject malicious scripts through HTML vulnerabilities like cross-site scripting (XSS).
Example:
Consider a scenario where user input is directly embedded into HTML. An attacker might inject malicious code. By separating JavaScript, the chances of such vulnerabilities can be minimized.
<!-- Secure example with external JavaScript -->
<!DOCTYPE html>
<html>
<head>
<title>Secure Example</title>
<script src="secure.js"></script>
</head>
<body>
<h1>Secure Input Handling</h1>
<form id="inputForm">
<input type="text" id="userInput" />
<button type="button" onclick="handleInput()">Submit</button>
</form>
</body>
</html>
8. Easier Testing and Debugging
Definition: Testing and debugging involve verifying that software functions correctly and fixing errors.
Explanation: External JavaScript files can be independently tested and debugged using browser developer tools. This modular approach simplifies the identification and resolution of issues.
Example:
With external JavaScript, you can load the script into various testing environments and use browser tools to set breakpoints, inspect variables, and step through the code.
// testable.js
function add(a, b) {
return a + b;
}
// test.html
<!DOCTYPE html>
<html>
<head>
<title>Testing Example</title>
<script src="testable.js"></script>
</head>
<body>
<script>
console.log(add(2, 3)); // Outputs: 5
</script>
</body>
</html>
Using developer tools, you can test the add function in isolation, making debugging more straightforward.
9. Scalability
Definition: Scalability refers to the ability of a system to handle increased load by adding resources.
Explanation: As web applications grow, maintaining scalability is crucial. External JavaScript files make it easier to scale by allowing developers to add new features without disrupting existing code.
Example:
<!-- scalable.html -->
<!DOCTYPE html>
<html>
<head>
<title>Scalability Example</title>
<script src="feature1.js"></script>
<script src="feature2.js"></script>
</head>
<body>
<h1>Scalable Web Application</h1>
<button onclick="feature1()">Feature 1</button>
<button onclick="feature2()">Feature 2</button>
</body>
</html>
By adding new features in separate external files, the application can grow in complexity without becoming unmanageable.
Practice Excercise Practice now
External References
What are External References in JavaScript?
External references in JavaScript refer to resources such as external JavaScript files, CSS stylesheets, and image files that are linked to a web page from an external source. These external resources are referenced in the HTML code of a web page using specific HTML tags or attributes, such as <script>, <link>
, or <img>
tags.
Advantages of External References
Code Organization: External JavaScript files help in organizing code by separating JavaScript logic from HTML content. This separation promotes a cleaner structure and makes it easier to manage and maintain codebases, especially in large projects.
Code Reusability: By referencing external JavaScript files, developers can reuse the same script across multiple web pages. This approach reduces code duplication, promotes consistency, and simplifies updates and maintenance.
Website Performance: External references contribute to improved website performance. For example, external JavaScript files can be cached by browsers, reducing load times for subsequent visits to the website. Similarly, external CSS files enhance styling performance and reduce page load times.
Collaborative Development: External references facilitate collaborative development. Multiple developers can work on different parts of a project simultaneously by referencing shared external files, streamlining workflow and promoting team productivity.
Implementation of External References
- Linking External JavaScript Files
- To link an external JavaScript file to an HTML document, use the <script> tag with the src attribute pointing to the external file's URL:
<!-- External JavaScript file -->
<script src="external.js"></script>
Linking External CSS Stylesheets
To link an external CSS stylesheet to an HTML document, use the <link>
tag with the rel attribute set to "stylesheet" and the href attribute pointing to the external CSS file's URL:
<link rel="stylesheet" href="styles.css">
Referencing External Images
To reference an external image in an HTML document, use the <img> tag with the src attribute pointing to the image file's URL:
<!-- External Image -->
<img src="image.jpg" alt="External Image">
Example of External References
Let's consider a practical example of using external references in a web development project.
HTML File (index.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External References Example</title>
<!-- External CSS Stylesheet -->
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Welcome to External References</h1>
<p>This is a sample web page demonstrating the use of external references.</p>
<!-- External JavaScript File -->
<script src="external.js"></script>
</body>
</html>
JavaScript File (external.js):
// External JavaScript File
alert("External JavaScript is linked successfully!");
CSS File (styles.css):
/* External CSS Stylesheet */
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
h1 {
color: #333;
}
p {
color: #666;
}
In this example, the HTML file (index.html) links to an external CSS stylesheet (styles.css) for styling and an external JavaScript file (external.js) for dynamic functionality. When the HTML file is opened in a browser, it will display the content styled by the external CSS and execute the JavaScript code from the external file.
Practice Excercise Practice now
Products
Partner
Copyright © RVR Innovations LLP 2024 | All rights reserved - Mytat.co is the venture of RVR Innovations LLP