X, Y, Z X Y Z X + Y : 1. What Is Javascript?Features of Javascript, What Is Javascript Syntax?
X, Y, Z X Y Z X + Y : 1. What Is Javascript?Features of Javascript, What Is Javascript Syntax?
Features of JavaScript:
JavaScript syntax:
var x, y, z; // How to declare variables
x = 5; y = 6; // How to assign values
z = x + y; // How to compute values
2. JavaScript Frameworks?
AngularJS
ReactJS
VueJS
jQuery
BackboneJS
NodeJS
EmberJS
MeteorJS
PolymerJS
Aurelia
5. JavaScript Objects
A javaScript object is an entity having state and behavior (properties and method). For
example: car, pen, bike, chair, glass, keyboard, monitor etc.
JavaScript is an object-based language. Everything is an object in JavaScript.
JavaScript is template based not class based. Here, we don't create class to get the
object. But, we directly create objects.
class MyClass {
constructor() { ..
method1() { ... }
method2() { ... }
method3() { ... }
...
}
7. JavaScript Operators
1) Arithmetic operators
3) Bitwise operators
4) Logical operators
! Logical NOT
5) Assignment operators
8. JavaScript Variables
A JavaScript variable is simply a name of storage location.
They are containers for storing data values.
In this example, x, y, and z, are variables
var x = 5;
var y = 6;
var z = x + y;
Here, x stores the value 5
y stores the value 6
z stores the value 11
There are two types of variables in JavaScript : local variable and global variable.
There are some rules while declaring a JavaScript variable (also known as identifiers).
1) Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
2) After first letter we can use digits (0 to 9), for example value1.
3) JavaScript variables are case sensitive, for example x and X are different variables.
default:
code to be executed if above values are not matched;
}
16. JavaScript For Loop,While loop,Break and Continue.
The JavaScript for loop iterates the elements for the fixed number of times. It
should be used if number of iteration is known. The syntax of for loop is given
below:
for (initialization; condition; increment)
{
code to be executed
}
The JavaScript while loop iterates the elements for the infinite number of times. It
should be used if number of iteration is not known. The syntax of while loop is given
below:
while (condition)
{
code to be executed
}
In an event, this refers to the element that received the event.
Methods like call(), and apply() can refer this to any object.
Exchanging Data:
When exchanging data between a browser and a server, the data can only
be text.
JSON is text, and we can convert any JavaScript object into JSON, and send
JSON to the server.
We can also convert any JSON received from the server into JavaScript
objects.
**********************************************HTML************************************************
1. What is HTML?
HTML stands for HyperText Markup Language.
HTML is used to create web pages and web applications.
HTML is widely used language on the web.
We can create a static website by HTML only.
Technically, HTML is a Markup language rather than a programming language.
</body>
</html>
3. HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.
4. HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading:
5. HTML Paragraphs
HTML paragraph or HTML p tag is used to define a paragraph in a webpage.
It is a notable point that a browser itself add an empty line before and after a
paragraph. An HTML <p> tag indicates starting of new paragraph.
6. HTML Links
HTML links are defined with the <a> tag:
7. HTML Images
8. HTML Buttons
The <button> tag defines a clickable button.
Inside a <button> element you can put content, like text or images. This is the difference
between this element and buttons created with the <input> element.
9. HTML Lists
HTML Lists are used to specify lists of information. All lists may contain one or more list
elements. There are three different types of HTML lists:
1. Ordered List or Numbered List (ol)
2. Unordered List or Bulleted List (ul)
3. Description List or Definition List (dl)
HTML colors are specified using predefined color names, or RGB, HEX, HSL,
RGBA, HSLA values.can set the color of text, set the color of borders,
In HTML, colors can also be specified using RGB values, HEX values, HSL values,
RGBA values, and HSLA values:
The HTML5 <canvas> tag is used to draw graphics, on the fly, via scripting (usually
JavaScript).
However, the <canvas> element has no drawing abilities of its own (it is only a container for
graphics) - you must use a script to actually draw the graphics.
The getContext() method returns an object that provides methods and properties for
drawing on the canvas.
TAG DESCRIPTION
<col> It is used with <colgroup> element to specify column properties for each
column.
The HTML <form> element defines a form that is used to collect user input:
Multimedia comes in many different formats. It can be almost anything you can hear
or see.
Examples: Images, music, sound, videos, records, films, animations, and more.
Web pages often contain multimedia elements of different types and formats.
Multimedia elements (like audio or video) are stored in media files.
The most common way to discover the type of a file, is to look at the file extension.
Multimedia files have formats and different extensions like: .swf, .wav, .mp3, .mp4,
.mpg, .wmv, and .avi.
21. The HTML <video> Element,The HTML <audio> Element
<video> element:
HTML 5 supports <video> tag also.
The HTML video tag is used for streaming video files such as a movie clip, song clip on the
web page.
Currently, there are three video formats supported for HTML video tag:
1. mp4
2. webM
3. ogg
The controls attribute adds video controls, like play, pause, and volume.
It is a good idea to always include width and height attributes. If height and width are not
set, the page might flicker while the video loads.
The <source> element allows you to specify alternative video files which the browser may
choose from. The browser will use the first recognized format.
The text between the <video> and </video> tags will only be displayed in browsers that do
not support the <video> element.
HTML5 defines DOM methods, properties, and events for the <video> element.
This allows you to load, play, and pause videos, as well as setting duration and volume.
There are also DOM events that can notify you when a video begins to play, is paused, etc.
<audio> element:
It defines sound content.
The controls attribute adds audio controls, like play, pause, and volume.
The <source> element allows you to specify alternative audio files which the browser may
choose from. The browser will use the first recognized format.
The text between the <audio> and </audio> tags will only be displayed in browsers that
do not support the <audio> element.
Audio tags:
1. Controls: It defines the audio controls which is displayed with play/pause buttons.
2. Autoplay: It specifies that the audio will start playing as soon as it is ready.
3. Loop: It specifies that the audio file will start over again, every time when it is completed.
4. Muted: It is used to mute the audio output.
5. Preload: It specifies the author view to upload audio file when the page loads.
6. Src: It specifies the source URL of the audio file.
The HTML Geolocation API is used to get the geographical position of a user.
Since this can compromise privacy, the position is not available unless the user approves it.
The getCurrentPosition() method is used to return the user's position.
Example:
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>