Presentation is loading. Please wait.

Presentation is loading. Please wait.

“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora www.aroraakshay.in.

Similar presentations


Presentation on theme: "“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora www.aroraakshay.in."— Presentation transcript:

1 “The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora www.aroraakshay.in

2 Most popular technologies – SO dev survey ‘15

3 The Name Java and JavaScript are as similar to each other as Car and Carpet.

4 What is JavaScript? JavaScript is a scripting language for web browsers. A scripting language is a language that "scripts" other things to do stuff. The primary focus is getting an existing “thing” to act the way you want.

5 Scripting language is an understatement JavaScript is a modern dynamic language. Used on both, Client and Server side.

6 Brief History of JavaScript It was originally developed by Netscape under the name “LiveScript”. The name was later changed to JavaScript. Including the prefix ‘Java’ was a marketing ploy of Netscape in order to make JavaScript look related to Java.

7 The language started to get popular with the second version of Netscape because of it being lightweight as compared to java applets. Microsoft reverse engineered the language and named it ‘Jscript’, just to escape from the Netscape lawyers :p.

8 JavaScript is interpreted, not compiled Since it is intended to be used in conjunction with a host (browser), it is made lightweight and fast. Compilation is time consuming and basically, not required.

9 Load and Go delivery In C/C++, the programs are delivered as an executable file. In JavaScript programs are delivered as text because it was originally intended to be embedded into web pages, and web pages are text. This makes JavaScript execution extremely simple.

10 Loose Type Casting In C/C++, Java, etc. you have to specify beforehand what type your variable will be. int x = 5; double d = 8.0; But JavaScript is loosely typed. It implies that JavaScript variables can be used without explicitly stating the type. var abc = 1; abc = "Changed to string";

11 Most of the things in JavaScript are objects JavaScript objects are key-value pairs. There is no such thing as a “class”. Functions, Arrays are also objects.

12 One Number type IEEE 754, also known as: double. 64-bit floating point. Implications: 0.1 + 0.2 is not 0.3 but 0.30000000000000004. However, integer arithmetic is always exact.

13 Strings These are sequence of 16-bit characters. You can write strings in both single and double quotes. var str1 = 'I am a string'; var str2 = "Me too";

14 null A value that is nothing.

15 undefined A value that is not even that. :p It is the default value of all variables. var abc; console.log(abc);// undefined

16 === and == operators == compares the values of the entities being compared irrespective of the type. var abc = "34"; var xyz = 34; Console.log(abc == xyz); //true === compares the values of the entities as well as their type. Console.log(abc === xyz); //false

17 Dynamic Objects Applies the concept of a hashtable (key/value pairs). var abc = new Object(); Creates an empty container of key/value pairs. A name can be any string, the value can be any value except undefined.

18 Make an object var company = new Object(); company.name = "Google"; company.headquarters = "Mountain View, CA"; company.makesMoneyThrough = "Advertisements";

19 Also var company = { "name":"Google", "headquarters":"Mountain View, CA", "makesMoneyThrough": "Advertisements" };

20 “The browser is really a very hostile programming environment”

21 Document Object Model It provides a structured representation of the document and it defines a way that the structure can be accessed from programs so that they can change the document structure, style and content. The DOM provides a representation of the document as a structured group of nodes and objects that have properties and methods.

22

23 Functions in JavaScript Functions are also objects in JavaScript. Code is stored in the form of strings. (Surprise!).

24 Using function constructor var sum = new Function('a','b', 'return a + b;'); console.log(sum(10, 20)); // 30

25 Using function declaration function sum(a, b) { return a + b; } console.log(sum(10, 10)); // 20

26 Using function expression var sum = function(a, b) { return a + b; } console.log(sum(5, 5)); // 10

27 Scopes There are no block scopes in JavaScript. There are only function scopes.

28 Events JavaScript is meant to provide interactivity to the webpages. The user does something on the page (Like click, hover,etc) and the page responds.

29 Event Handler It waits until a certain event has taken place. It “handles” the event by executing some JavaScript that you have defined.

30 3 rd Party Libraries and frameworks jQuery: Excellent and most popular JavaScript Library. Reactjs: Framework for creating powerful user interfaces (One-way data binding). Made by Facebook. Angular js: Framework for powerful web applications (Two-way data binding). Made by Google.

31 Recommended Reading Nearly all the books about JavaScript are quite awful. The good ones: Eloquent JavaScript by Marijin Haverbeke (Free ebook). JavaScript: The good parts by Douglas Crockford.


Download ppt "“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora www.aroraakshay.in."

Similar presentations


Ads by Google