Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
Uncaught TypeError: this.firstname is not a function

I'm studying knockout js and happened error whats is the problem??

<span data-bind="text: fullname"></span>

<script type="text/javascript">
function AppViewModel() {
  this.firstName = ko.observable('Bob');
  this.lastName = ko.observable('Smith');

  this.fullname = ko.computed(function() {
    return this.firstname() + " " + this.lastname();
  },this);
}

// <!-- ko.applyBindings(viewModel); -->
var vm = new AppViewModel();
ko.applyBindings(vm);
</script>

when I call this,

Uncaught TypeError: this.firstname is not a function

happen... what is wrong?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At

return this.firstname() + " " + this.lastname();

You did not capitalize the "n" in firstname and lastname. So try something like this:

function AppViewModel() {
  this.firstName = ko.observable('Bob');
  this.lastName = ko.observable('Smith');

  this.fullname = ko.computed(function() {
    return this.firstName() + " " + this.lastName();
  },this);
}

// <!-- ko.applyBindings(viewModel); -->
var vm = new AppViewModel();
ko.applyBindings(vm);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!