X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript Examples I


Where to Insert JavaScript

JavaScript in <head>
JavaScript in <body>
An external JavaScript

Where to  explained


JavaScript Statements, Comments and Blocks

JavaScript statements
JavaScript blocks
Single line comments
Single line comments at the end of a line
Multiple lines comments
Single line comment to prevent execution
Multiple lines comment to prevent execution

Statements explained


JavaScript Variables

Declare a variable, assign a value to it, and display it
Create numeric variables
Create variables of different types
Add two numbers
Add two strings

Variables explained


JavaScript Data Types

Declare (create) numbers
Declare (create) strings
Declare (create) an array
Declare (create) an object
Use typeof to find the type of variables
Undefined and null

Data types explained


JavaScript Functions

Call a simple function
Call a function with an argument
Call a function with an argument 2
Call a function that returns a value
Call a function that converts Fahrenheit to Celsius

Functions explained


JavaScript Events

An onclick event changes an HTML element
An onclick event changes its own element
An onclick event calls a function

Events explained


JavaScript Strings

Show some string examples
Find the length of a string
Find the position of the first occurrence of a text in a string - indexOf()
Search for a text in a string and return the text if found - match()
Replace characters in a string - replace()
Convert string to upper case - toUpperCase()
Convert string to lower case - toLowerCase()
Split a string into an array - split()

Strings explained



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook