This article translates the JavaScript Tutorial playlist of up master Kudvenkat on YouTube
SOURCE Address here:
https://www.youtube.com/watch?v=PMsVM7rjupU&list=PL6n9fhu94yhUA99nOsJkKXBqokT3MBK0b
This video we will discuss
1.Javascript is case-sensitive
Annotations in 2.Javascript
Data types in 3.Javascript
Does JavaScript care about capitalization
Yes, JavaScript is a case-sensitive programming language. Variables, keywords, methods, and object properties as well as event handlers are case-sensitive
Example 1:alert () function names must all be lowercase letters
[Script] alert ("javascripts Basics Tutorial"); [ /SCRIPT]
The example 2:alert () and Alert () are different functions. Alert () causes undefined errors. To check the error message, press F12
[Script] Alert ("javascripts Basics Tutorial"); [/script]
Comments in javascript: There are two types of annotations in JavaScript
1) Single-line comment
Example:
[Script] // This was a Sinle line comment [/script]
2) Multi-line Comment
Example:
[Script] /* This was a multi Line*/[/script]
Data types in JavaScript
The following are the different data types in JavaScript
numbers-5,5.234
Boolean-true/false
String-"MyString", ' MyString '
Use the var keyword to create a variable in JavaScript. Variable names are case-sensitive
To create an integer variable in C #, we use the INT keyword
int X = 10;
Use the string keyword to create a string variable
String srt= "Hello"
In JavaScript, whatever variables we make, we use the var keyword, and what kind of variable depends only on what kind of content is being allocated.
var a = 10;
var b = "MyString";
In C #, you can't assign a string value to an integer variable
int X = 10;
X = "Hello"; Compiler Error
JavaScript is a dynamic type language. That is, the JavaScript data type is automatically changed as needed when the script is processed. Note The following example, we first stored a number in the myvariable, And then we use it to store a string
[Script] var myvariable = +; alert (myvariable); = "Assigning a string value"; alert (myvariable); [/script]
When two numbers use the + symbol, the javscript adds two digits.
[Script] var a = ten; var b =; var c = a + b; alert (c); [/script]
Output:30
When two strings are connected by a + symbol, JavaScript merges the two string into a
[Script] var a = "Hello" var b = "JavaScript"; var c = a + b; alert (c); [/script]
Output:hello JavaScript
When a number is connected to a string by a + symbol, JavaScript converts the value of the number to a string and then the two string into a single
[Script] var a = "number is:" var b = Ten; var c = a + b; alert (c); [/script]
Output:number is 10
[Script] var a = "a" var b = Ten; var c = a + b; alert (c); [/script]
output:5010
It is important to note that if you use a-symbol to connect a number and a string, the number is not converted to string
[Script] var a = "a" var b = Ten; var c = A- b; alert (c); [/script]
Output:40
Translation JavaScript basics