knockoutJs interview questions


knockoutJs interview questions

1. What is Knockoutjs?
Knockoutjs is an open source client side MVVM (Model View ViewModel) pattern. Knockout is a pure JavaScript library which can work with any web framework. Knockoutjs mostly used for design a SPA (Single Page Application). Knockoutjs library is very small and lightweight library.

Knockoutjs automatically refresh UI when its data model update. That’s way View – Model directly not associated with each other View dependent on ViewModel (Data Model) and when anything changes in ViewModel it automatically reflect on View part.

Many UI library also work With the help of KO, we can implement all functionality more simply manner and works with any server or client-side technology.

2. What is the features of Knockout JS?

Dependency Tracking -
Knockoutjs make dependency between View and ViewModel. Knockoutjs track any changes on dependent object when.
 When dependent object in the dependency tracking, Knockoutjs automatically update the UI (DOM) when your data model is change.

Declarative Binding -
In the declarative binding, your UI (DOM) is connected to your data model in a    simply manner using data-bind control

Automatic UI Refresh –
knockoutjs automatically refresh UI when ViewModel update. Any changes ViewModel data automatically refresh on view.

Template Binding -
Templating is use for build sophisticated UI in easily. Knockoutjs populate the DOM element in nested and repeating manner with the help of foreach, if, with, and other control flow bindings and third party template engine.

Pure JavaScript library –
Knockoutjs works with any server or client-side technology. And easily work with existing web application without any major changes.

Compact Size – Knockoutjs size is around 13kb after gzipping
Support all modern – Knockoutjs support almost every modern browsers (IE 6+, Firefox 2+, Chrome, Safari, others)
Easy to implement - No need to change existing architecture of project. Can easily implement existing architecture with the help of KO.

3. What is the Benefit of MVVM?

Separation between UI and logic
Reduce development Time
Reusability of UI
4. What is observable in Knockout JS?
Observable is a model property which is use to notify subscribers changes and it automatically detect dependencies. Observable property updates your UI automatically when the view model changes. 

5. What is different way of using Templates in Knockoutjs?
Knockoutjs provide two ways to use templates.
Native Templating - Its way to build sophisticated UI using foreach, if, with, and other control flow bindings. Native Templating dependent on knockout     itself.

String-based Templating –String-based templates use to work with third-party template engine like jQuery.tmpl or the Underscore template engine.

6. How many types of data binding available in knockout JS?
Visible Binding
Text Binding
Value Binding
CSS Binding
style Binding
Attr Binding
Template Binding

Comments

Post a Comment