Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Typescript

200 Aufrufe

Veröffentlicht am

Slide prepared for seminar in my company

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

Typescript

  1. 1. Neal Creative | click & Learn more Neal Creative © TIP │ Use the built-in color palette with green and yellow for callouts and accents
  2. 2. 2 TypeScript @Nikhil_Thomas
  3. 3. Javascript Typescript
  4. 4. 4 Javascript
  5. 5. Abstraction is a process where you show only “relevant” data and “hide” unnecessary details from the user Encapsulation is the process of combining data and functions into a single unit Modularity is the act of partitioning a program into single units Polymorphism is the ability of a message or data to be processed in more than one form Inheritance is the capability of one class to inherit properties from another class Basic Characteristics of Object Oriented Programming 1 2 3 4 5
  6. 6. 6 JavaScript Objects OBJECT Property 1 Property 2 Property 3 Property 4 Property 5 Property 6
  7. 7. 7 TYPESCRIPT:THE FUTURE JAVASCRIPTTECHNOLOGIES KEEPS CHANGES LEARN USE CREATE MOVE WITH TECHNOLOGY
  8. 8. 1
  9. 9. 2 VARIABLES TYPES OPERATORS FUNCTIONS INTERFACE CLASSES
  10. 10. VARIABLES • Variables is a container to hold data and is done by var keyword or let keyword. • If we skip keyword to declare a variable we get an error message as “cannot find name”. Example:
  11. 11. Let vs Var Keyword • The scope of a variable defined with var is global scope or declared outside any function. • The scope of a variable defined with let is block scope. Example:-
  12. 12. 12 TYPES • Type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data(example : number, string). • TypeScript is a strongly typed language and JavaScript is a weakly typed language. • TypeScript has a small number of build-in types, including, 1. Number 2. String 3. Boolean 4. Array 5. Enum 6. Void & Any
  13. 13. Number & String Types • The number type can be any set of any numbers • The string type can be any string-i.e,any sequence of Unicode characters encloses within a single or double quotes
  14. 14. • You can also use template strings, which can span multiple lines and have embedded expressions. These strings are surrounded by the backtick/backquote (`) character, and embedded expressions are of the form ${ expr }.
  15. 15. Boolean Types • Booleans have only two valid value true/false • Before version 0.9 of typeScript, the Boolean type was described using bool keyword. There was a breaking change in the 0.9 TypeScript language specifications, which changed the keyword to boolean
  16. 16. Enum • Enums allow us to define a set of named numeric constants. • An enum can be defined using the enum keyword
  17. 17. Array Types • Array types define both that a variable is an array and the kind of elements it contain. • Syntax:- 1. var [identifier]:type=[]; 2. var [identifier]:Array<type>=[]; • Example:-
  18. 18. Any& Void types • The any data type is the super type of all types in TypeScript. It denotes a dynamic type.if we don’t know a particular type we can choose any type • void is a little like the opposite of any: the absence of having any type at all. You may commonly see this as the return type of functions that do not return a value
  19. 19. 19 Operators • Operators are user for some operations on data. • All the standard JavaScript operators are available in TypeScript and they are, 1. Increment and Decrement Operator (“++“, “--“) 2. Binary Operator (“+“, “-“, “/“, “*“, “%“) 3. Bitwise Operator("~" , "&”, "|", "^" ,"<<" ,">>“) 4. Comparison Operators (“==" , “!=“ , “>", “<" ,"<=“, ”>=”) 5. Logical Operator (“&&“, “||“, ”!”) 6. Conditional Operator(“?:“)
  20. 20. 20 Functions • Function is a block of code designed to perform a particular task. • Similar to JavaScript function. • Several optional features:types,optional parameters,default parameters. • A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters. Example:-
  21. 21. 21 Optional Parameters • Parameters are required by default in TypeScript and we are creating an optional parameters with a question mark(?). • Example:-
  22. 22. 22 Default Parameters • In Default parameters we are simply assigning some text as default value.when ever we omitted the argument default value is taken. Example:-
  23. 23. 23 Class • Class is a way to bind data's and functions relating to any entity together. • Classes are defined with the class keyword and instantiated with the new keyword. • The syntax should look familiar if you’ve used C# or Java before.
  24. 24. 24 Inheritance • Classes can inherit properties from other classes • A class inherits from another class using the extends keyword. • Child class inherits all methods and properties Example:-
  25. 25. 25 Access Modifiers • Typescript supports the common access modifiers that control class members access. • Typescript access modifiers are : 1. public : available on instances everywhere 2. private : not available for access outside the class. 3. protected : available on child classes but not on instances directly.

×