JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complimentary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.
In this article we will discuss about below topics.
- Is JavaScript case sensitive
- Comments in JavaScript
- Data types in JavaScript
Is JavaScript case sensitive
Yes, JavaScript is case sensitive programming language. Variable names, keywords, methods, object properties and event handlers all are case sensitive.
Alert Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
alert("JavaScripts Basics Tutorial"); | |
</script> |
Comments in JavaScript
There are 2 types of comments in JavaScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Single Line Comment | |
Example : | |
<script> | |
// This is a single line comment | |
</script> | |
2) Multi Line Comment | |
Example: | |
<script> | |
/* This is a multi line | |
comment Statement | |
*/ | |
</script> |
Data types in JavaScript
The following are the different data types in JavaScript
numbers - 1, 2, 3.4
boolean - true / false
string - "TestString", 'TestString'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In Javascript to create an integer variable we use int keyword | |
int x=10; | |
//to create a string variable we use string keyword | |
string str = "Hello World" | |
//With JavaScript we always use var keyword to create any type of variable. | |
var a = 10; | |
var b = "Test String"; | |
//In Javascript, you cannot assign a string value to an integer variable | |
int X = 10; | |
X = "Hello"; // Compiler error |
Summary