this is the fiddle - http://jsfiddle.net/iRamesh/36N4m/
Not sure why computed observable is not returning any value. I know how to make it working but not sure why t
object literals are quite simple to create, which makes them awesome. But this is one of the reasons I prefer using functions to create view models. With an object literal you could just extend the view model and create the computed ... or with the function you can do it all in one function statement, as @RPNiemeyer points out.
Another option is to use the revealing module pattern, which I like best: http://jsfiddle.net/johnpapa/36N4m/1/
var viewModel = (function() {
var
firstName = ko.observable("r"),
lastName = ko.observable("j"),
fullName = ko.computed(function() {
return firstName();
});
return {
firstName: firstName,
lastName: lastName,
fullName: fullName
}
})();
ko.applyBindings(viewModel);