I don’t know JS (Part-II)

Rashmi Vishwakarma
3 min readMar 30, 2019

--

So, In part I of the series we Grace came to know about JavaScript. Let’s see what happens today. It’s beautiful sunny day, Ada and Grace decided to meet at cafe. Grace is at venue and she is super excited to know more about UI. Ada also reached in sometime. They ordered coffee and with first sip of it discussion started…

Grace: Howdy Ada

Ada: Hey, what’s up?

Grace: Do you know I started learning JavaScript. It is really interesting.

Ada: That’s really cool.

Grace: While reading about JavaScript I came across some articles on Angular and React. These are really very popular, right?

Ada: Yes. And the most interesting fact about Angular and React is that Google developed Angular and React is maintained by Facebook. Also, Angular is the JavaScript framework and React is JS library.

Grace: What is the difference between framework and library?

Ada: I think that the difference is that frameworks follow the IoC principle, i.e. don’t call us, we’ll call you. And for libraries, we make a call.

Grace: hmmm… How is Angular as a framework?

Ada: Do you mean Angular or AngularJS?

Grace: Ain’t they are same?

Ada: Actually they are not the same. Angular was a ground-up rewrite of AngularJS. We refer “AngularJS” to the 1.X versions and “Angular” without postfix “JS” to versions 2 and up.

Grace: Perfect. Does React version also have names like angular version?

Ada: No. It is only React

Grace: Should I use Angular or AngularJS?

Ada: Angular, as it is the latest version and we should always use the latest version.

Grace: What makes Angular so popular?

Ada: There are many reasons, it is open source JavaScript framework for developing web and mobile apps, it is completely extensible and works well with other libraries, it supports SPA, data binding is easy, it provides services, reusable components, form validation, routing, and soo many

Grace: And Google is supporting it

Ada: Hahahaa... true

Grace: What is SPA by the way?

Ada: SPA is a Single Page Application. It interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server.

Grace: What was next? hmmm.. data binding right?

Ada: Absolutely. Data binding is the synchronization between the model and the view. As is the case with most frameworks that follow an MVC architecture, Angular too does. Angular supports two way as well as one-way data binding.

Grace: How services work in Angular?

Ada: Services and factories are two main things that Angular provides

Grace: Both are same?

Ada: No, factories are functions that return the object, while services are constructor functions of the object which are instantiated with the new keyword. And that both are singletons.

Grace: Can you write unit test cases with this framework?

Ada: Good point. One can write and run test cases using Jasmine and Karma respectively. Jasmine is a JavaScript testing framework and Karma is the test runner.

Grace: Do they come with Angular?

Ada: The Angular CLI downloads and installs everything you need to test an Angular application.

Grace: Angular CLI?

Ada: Angular CLI is a command line interface to scaffold and build angular apps using nodeJS modules.

Grace: How much time does it require to learn Angular?

Ada: Well it depends, the only prerequisite is JavaScript.

Grace: Oh wow! I am learning JavaScript now and after that, I can learn Angular. Hurray!!!

Ada: I have to go now. We will catch up soon till then bye.

Grace: See you, Ada.

In this conversation, we covered the basics of one of the most popular JavaScript framework i.e. Angular. Keep visiting this space for more such stories.

--

--