未加星标

Introduction to JavaScript

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二03 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏
History of javascript

According to W3.org, “JavaScript was created in 10 days in May 1995 by Brendan Eich, then working at Netscape and now of Mozilla. JavaScript was not always known as JavaScript: the original name was Mocha, a name chosen by Marc Andreessen, founder of Netscape. In September of 1995 the name was changed to LiveScript, then in December of the same year, upon receiving a trademark license from Sun, the name JavaScript was adopted. This was somewhat of a marketing move at the time, with Java being very popular around then”.

Javascript is a cross plateform object oriented scription language. Javascript is case-sensitive language. Before jQuery, Javascript is used only for client side validations in other word you can say that javascript is most underrated language. In middle of 2006 jQuery comes and it change whole concept about javascript. Now days we can do all those things which can do in server side technology. There are so many javascript library or framework available. Some of these are listed below.

1:NodeJS 2: AngularJS 3: ReactJS 4: VueJS 5: EmberJS

6:MeteorJS 7: BackboneJS 8: ExpressJS 9: WebRxJS 10: jQuery

First Program

Before going to datatypes in javascript i am just write a program which says Hello world.I am using Visual Studio. If you dont have VS then you can find from https://www.visualstudio.com/downloads/. Yon can use any editor which you want to use even you can use notepad aswell.


Introduction to JavaScript

Select Empty Project.


Introduction to JavaScript

Add New Item > Html Page and name it Index.html


Introduction to JavaScript
In index.html <title>My First Program in Javascript</title> alert("Hello world");

Output


Introduction to JavaScript

DataType

Now we write a program for hello world. Lets talk about data types. Javascript is dynamic language like any other language you dont need to declare the type of variable. If i am talking about C, C++, C#, Java and etc. you have to define the data type when you declare the variable.

In C# int firstNumber = 10; string name = "Pramod"; bool onlyforstudent = true; In Javascript var firstNumber = 20; var name = "Pramod"; var onlyforstudent = true;

There are two data type in javascript.

1: Primitive datatype

2: Object datatype


Introduction to JavaScript

Primitive Datatype:All type which is not object data type which holds immutable value is called primitive datatype like boolean,number.

There are six primitive datatypes.

1:) Boolean :Boolean can have only two values true or false.

var onlyforstudent = true;

2:) Null:The null has only one value that is null.

var student= null;

3:) Undefined:A variable which is declared but not assigned any value

var studentDetail;

4:) Number:There is only one number type for all double, number.

var rollNo=12;

5:) String :String is use for represent textual data.

var name = “Pramod”;

6:) Symbol:Symbol is a funtion which returns a value type symbol.

var mySchool = Symbol();

Html Page <!DOCTYPE html> <html> <head> <title>My First Program in Javascript</title> <meta charset="utf-8" /> </head> <body> <script> alert("Hello world"); var onlyforstudent = true; console.log(onlyforstudent); var student = null; console.log(student); var studentDetail; console.log(studentDetail); var rollNo = 12; console.log(rollNo); var name = "Pramod"; console.log(name); var mySchool = Symbol(); typeof mySchool; console.log(mySchool); var mySchoolObj = Object(mySchool); typeof mySchoolObj; console.log(mySchoolObj); </script> </body> </html>

Output


Introduction to JavaScript

2:) Object :Any data type which in not primitive is Object. Object is collection of properties. Javascript follow object literal syntax which means a list of zero or more pair of property name and associated values of an object enclosed with {}.

In javascript object is mapping between key and values. Functions are objects in javascript. Some of following objects in javascript.

1:Date

2:Array

3:Typed Arrays

4:Maps

5:Sets

6:WeakMaps

7:WeakSets

We will talk more about detail in when we learn Array in javascript.

Hope this article is helpful.

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

分页:12
转载请注明
本文标题:Introduction to JavaScript
本站链接:http://www.codesec.net/view/529793.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(28)