Professional Documents
Culture Documents
WT Notes by Matin
WT Notes by Matin
It allows you to make web pages interactive by manipulating the content and behavior of HTML and
CSS.
JavaScript is a key component of web development, enabling dynamic and interactive user
experiences.
console.log(fn1);
fn1 = fn2;
fn2 = nextFibonacci;
Output :
1
3] variables and data types, statements, operators, literals, functions,
objects, arrays, built in objects, JavaScript debuggers (Read ).
1. Variables and Data Types:
Variables are used to store and manipulate data.
Data types include numbers, strings, booleans, objects, etc.
2. Statements:
JavaScript uses statements to control the flow of a program.
Examples include if statements, for loops, and switch statements.
3. Operators:
JavaScript supports various operators like arithmetic, assignment, comparison, and
logical operators.
4. Literals:
Literals are direct representations of values in JavaScript code. Examples include
numeric literals, string literals, and boolean literals.
5. Functions:
Functions are reusable blocks of code that can be defined and called with different
arguments.
They play a crucial role in modularizing code.
6. Objects:
Objects are collections of key-value pairs, representing entities.
Object-oriented programming is a fundamental concept in JavaScript.
7. Arrays:
Arrays are ordered collections of values, which can be of any data type.
They provide a way to store and manipulate lists of items.
8. Built-in Objects:
JavaScript has several built-in objects like Math, Date, String, Array, etc., that
provide useful functionality.
9. JavaScript Debuggers:
Debuggers help developers identify and fix errors in their code.
Modern browsers come with built-in developer tools that include debugging
features.
2
4] DOM (Document Object Model):
1. Introduction to Document Object Model:
The DOM has evolved through different levels (DOM Level 1, Level 2, etc.).
This tree structure consists of nodes, where each node corresponds to an element,
attribute, or any other structural component within the document.
Element nodes represent HTML or XML elements.
Developers can traverse the DOM tree to access, modify, or delete nodes.
Document Object Model serves as a bridge between web documents and scripts, allowing developers to
create dynamic and interactive web pages
Advantages of jQuery
Cross-browser Compatibility :
jQuery abstracts away many of the differences between browsers, providing a
consistent interface.
Simplified Syntax:
jQuery simplifies complex tasks into a concise syntax,. This makes code more readable
and easier to maintain.
DOM Manipulation:
jQuery simplifies DOM manipulation, allowing developers to easily select and modify
elements, handle events, and update the document structure.
Animation Effects:
jQuery provides built-in methods for creating animations and effects on web pages.
3
jQuery Syntax:
Example :
Code :
<!DOCTYPE html>
<head>
<title>jQuery Example</title>
<script>
// jQuery code
$(document).ready(function ()
$("#exampleElement").text("Hello, jQuery!");
Output :
4
6] What is Angular JS? Explain Angular JS directives for data
binding with example
AngularJS Directives
AngularJS directives are extended HTML attributes with the prefix ng-.
The ng-app directive initializes an AngularJS application.
The ng-init directive initializes application data.
The ng-model directive binds the value of HTML controls (input, select, textarea) to
application data
Example
Code
<!DOCTYPE html>
<html ng-app="">
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
</body></html>
Output:
5
Features of Angular JS :
8] Write the JavaScript code for name, email and mobile number validation
in registration form.
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Registration Form</h2>
<label for="name">Name:</label>
6
<label for="email">Email:</label>
</form>
<script>
function validateForm() {
if (!name) {
return false;
if (!email) {
return false;
if (!mobile) {
return false;
alert("Registration successful!\n\nName: " + name + "\nEmail: " + email + "\nMobile: " + mobile);
return true;
</script>
</body>
</html>
7
Output :
***
I AM BATMAN