1 00:00:02,540 --> 00:00:08,360 With our basic class if we now go to the dist folder and we inspect the app J as file we see what is 2 00:00:08,360 --> 00:00:13,130 generated in JavaScript and there you see we have essentially the same code. 3 00:00:13,580 --> 00:00:21,230 Two important differences are that the name field which we have here does not exist like this here in 4 00:00:21,230 --> 00:00:22,280 the class. 5 00:00:22,280 --> 00:00:28,080 This would actually be supported in modern javascript but it depends on the words of JavaScript you're 6 00:00:28,100 --> 00:00:29,140 building for. 7 00:00:29,150 --> 00:00:33,220 So in iOS 6 alone it's not supported actually. 8 00:00:33,500 --> 00:00:37,430 And of course what's also missing is the type assignment. 9 00:00:37,430 --> 00:00:45,230 We do have our constructor logic though and indeed this is how you do add properties to do to be created 10 00:00:45,260 --> 00:00:46,120 objects. 11 00:00:46,130 --> 00:00:53,030 In vanilla javascript when not using the latest version of JavaScript where it is fields and text would 12 00:00:53,030 --> 00:00:54,530 also be supported. 13 00:00:54,530 --> 00:00:56,540 So this is what I have in JavaScript. 14 00:00:56,540 --> 00:01:01,880 Now it gets interesting however if we go to the T as conflict JS and file and we've switched the target 15 00:01:01,880 --> 00:01:08,810 from iOS 5 to iOS 6 and comment out lip here so that the correct and recommended libraries are added 16 00:01:08,810 --> 00:01:10,940 by typescript automatically. 17 00:01:10,940 --> 00:01:16,010 If you're not saved as config file and you go back to app j ust you see something totally different 18 00:01:16,360 --> 00:01:18,820 and that's pretty interesting what we see here. 19 00:01:18,860 --> 00:01:20,980 What do we have here. 20 00:01:20,990 --> 00:01:30,650 Well what we need and half here is a so-called constructor function constructor function is something 21 00:01:30,650 --> 00:01:37,640 which is built into javascript which has basically been there for ever you could say and this is vanilla 22 00:01:37,820 --> 00:01:44,540 non modern javascript is a way of creating object blueprints. 23 00:01:44,540 --> 00:01:51,170 It's a function which is called with help of the new keyword and then all of a sudden magically this 24 00:01:51,170 --> 00:01:56,540 function even though it has no return statement inside of it does return something as you see when we 25 00:01:56,540 --> 00:02:03,100 call it here it returns an object a new object which will have a name prop.. 26 00:02:03,170 --> 00:02:10,010 So this concept is not new it's not introduced by modern JavaScript or by typescript the idea of having 27 00:02:10,010 --> 00:02:16,040 blueprints for objects has been around the javascript for a very long time in the past. 28 00:02:16,040 --> 00:02:22,730 However we had to use constructor functions and since this could be a bit unintuitive especially to 29 00:02:22,730 --> 00:02:29,000 developers who might have worked with different programming languages modern javascript introduced the 30 00:02:29,000 --> 00:02:35,030 idea of classes of this cleaner syntax and typescript supports this as well. 31 00:02:35,030 --> 00:02:41,300 And because of type scripts powerful compilation you can choose where you want to compile the older 32 00:02:41,300 --> 00:02:48,020 style which of course works in Web browsers or introduce more modern iOS 6 style which we saw before 33 00:02:48,350 --> 00:02:51,590 which looks very much like this year. 34 00:02:51,590 --> 00:02:57,620 The key takeaways that we have this feature built into javascript and supported by typescript that we 35 00:02:57,620 --> 00:02:59,990 can define object blueprints.