Create a computed observable for formatted values for a bunch of variables
问题 I have 3 observable variables in view-model, and want to output to formatted value. However, I don't want to write computed method for each of them since they are identical. What is the best way to reuse the code? Thanks. The code I am going to achieve is: this.formattedPrice = ko.computed({ read: function () { return '$' + this.price().toFixed(2); }, write: function (value) { // Strip out unwanted characters, parse as float, then write the raw data back to the underlying "price" observable