Tutorialsplane

KnockoutJS Computed Observables


KnockoutJS Computed Observables– Computed observables are functions that are dependent upon one or more observables, computed observables automatically update if any of them change. Here in this tutorial, we are going to explain how you can create computed observables and use them. You can use our online editor to edit and run the code online.


KnockoutJS Computed Observables Example

Syntax

Sntax of Computed Observables is-

KnockoutJS Computed Observables Example:

 this.variableName = ko.computed(function() {
        // your code goes here..
    }, this);

Let us create a very basic example to understand the Computed Observables –

KnockoutJS Computed Observables Example:



   <title>KnockoutJS Example</title>
   


<div>

   FirstName <br/>
   LastName <br/>
   Hello <span data-bind="text:fullname">.
    
</span></div>



Learn KnockoutJS