Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Introduction to JavaScript
WhatsApp
Abhijeet Singh
4y
5.9k
0
1
100
Article
Jsintroduction.rar
Introduction
JavaScript was invented by Brendan Eich.
JavaScript made its first appearance in Netscape 2.0 in 1995 with the name LiveScript.
ECMAScript
is the name of the standard Javascript and "Standard ECMA-262 ECMAScript Language Specification" is the official name of the JavaScript standard.
JavaScript is most commonly used as a client-side scripting language. This means that JavaScript code is written into an HTML page.
Although the names are much alike, JavaScript is primarily a scripting language for use within HTML pages, whereas Java is a real programming language that does quite different things from JavaScript.
Features
JavaScript is a lightweight, interpreted programming language.
Designed for creating network-centric applications.
Open and cross-platform.
Advantages of JavaScript
Less server interaction
Immediate feedback to the visitors
Increased interactivity
Richer interfaces
The contents of HTML elements are commonly manipulated using JavaScript.
Example 1:
Changing HTML Content
<html>
<body>
<h1>
My First JavaScript</h1>
<p id=
"abhijeet"
>
JavaScript can change the content of an HTML element.
</p>
<script>
function
myFunction() {
x = document.getElementById(
"abhijeet"
);
// Find the element
x.innerHTML =
"Hello guyzz"
;
// Change the content
}
</script>
<button type=
"button"
onclick=
"myFunction()"
>
Click Me!</button>
</body>
</html>
Output
The isNaN() function determines whether a value is an illegal number (Not-a-Number).
So we can say that the isNaN() function returns true if the value is NaN (Not-a-Number) and false if not.
Example 2:
Validate Input
<html>
<body>
<h1>
JavaScript</h1>
<p>
Please input a number.</p>
<input id=
"abhijeet"
type=
"text"
>
<script>
function
myFunction() {
var
x = document.getElementById(
"abhijeet"
).value;
if
(x ==
""
|| isNaN(x)) {
alert(
"Not Numeric"
);
}
}
</script>
<button type=
"button"
onclick=
"myFunction()"
>
Click Me!</button>
</body>
</html>
Output
Advantages of JavaScript
JavaScript
JavaScript Features
JavaScript Introduction
Up Next
Ebook Download
View all
Voice of a Developer: JavaScript From Scratch
Read by 10.9k people
Download Now!
Learn
View all
Membership not found