Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to JavaScript academy.zariba.com 1. Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including.

Similar presentations


Presentation on theme: "Introduction to JavaScript academy.zariba.com 1. Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including."— Presentation transcript:

1 Introduction to JavaScript academy.zariba.com 1

2 Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including JavaScript in your project 5.Data Types and Variables 6.Operators and Expressions 7.Conditional Statements 8.Loops 9.Arrays 10.Functions 11.Objects 2

3 3 What is JavaScript? JavaScript is a front-end* scripting language It is embedded in your HTML page It is interpreted by the browser JavaScript is the most popular programming language in the world

4 4 JavaScript Pros and Cons Pros: Lightweight Powerful Simple Easy to Learn Lots of Open-Source Libraries Great for UI Cons: Limited functionality Strange behavior Terrible OOP (to be fixed in ES6) Functionality differs through browsers Arrays are not really arrays …

5 The Weird JavaScript Stuff 5

6 Including JavaScript in your Project 6

7 Data Types and Variables 7 JavaScript is a typeless language – the type can be changed Strings can be declared with ‘ or “

8 Operators and expressions 8 CategoryOperators Arithmetic+ - * / % ++ -- Logical&& || ^ ! Binary& | ^ ~ > Comparison== != = Assignment= += -= *= /= %= &= |= ^= >= String concatenation+ Type Conversionis as typeof Other. [ ] ( ) ?: new Operators are roughly the same as in C# “/” can yield NaN or +/- Inifinity Comparison should be done with “===“

9 Conditional Statements 9 If, if-else, if-else-if, switch case statements are all used in the same way as in C# One key difference is that every type has an inherited Boolean value Evaluated to False – false, 0, “”, null, undefined, NaN

10 Loops 10 While, do-while, for and for-in (sort of like foreach in C#) are used in the same way as in C# For-in iterates over the indices of an array or over the properties of an object For-of is a new statement much like foreach in C#. For-of is not supported by all browsers

11 Arrays 11 Arrays are almost nothing like in C# They combine the properties and methods of Dictionary, Stack, Queue, Array … etc

12 Functions 12 Functions are similar to methods in C# Declared by the keyword function There is no function overloading, it can be faked by using optional parameters(typescript) or checking the arguments length

13 Objects 13 Objects in JavaScript are different from C# You can give an object a set of attributes (properties) and actions (functions) Syntax is similar to anonymous types in C#

14 14 Homework 1.Rewrite the first 2 tasks from every lecture in the C# part 1 module in JavaScript 2. Make a list of the key differences between JavaScript and C#

15 15 References

16 16 Zariba Academy Questions


Download ppt "Introduction to JavaScript academy.zariba.com 1. Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including."

Similar presentations


Ads by Google