Header add

In this article we will learn about Basics of JavaScript.

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

<script>
alert("JavaScripts Basics Tutorial");
</script>
view raw alert.js hosted with ❤ by GitHub

Here you can see we use alert() as case sensitive, we can't use Alert() here so it should be throws error Alert is not defined.

Comments in JavaScript

There are 2 types of comments in JavaScript.

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>
view raw comment.js hosted with ❤ by GitHub


Data types in JavaScript

The following are the different data types in JavaScript

numbers - 1, 2, 3.4
boolean - true / false
string - "TestString", 'TestString'


// 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
view raw variables.js hosted with ❤ by GitHub



Summary
In this tutorial we discussed Basics of JavaScript. If have any question related to this topic then give your feedback.
Previous Post Next Post