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

127
Views
JavaScript Math Function

Given an object containing the number of positive and negative reviews, for example { positive: 24, negative: 8 }, return the review positivity score.

function getReviewPositivityScore (positive, negative) {
  let a = positive;
  let b = negative;
  let result = a - b  ;
  return  result;
}

module.exports = getReviewPositivityScore;

Error message I get: getReviewPositivityScore 1) should return the number of positive reviews minus the number of negative reviews

0 passing (6ms) 1 failing

  1. getReviewPositivityScore should return the number of positive reviews minus the number of negative reviews:

    AssertionError: expected NaN to deeply equal 16

    • expected - actual

    -NaN +16

    at Context. (.guides/secure/test3.5.1.js:8:17) at processImmediate (internal/timers.js:439:21)

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

0

Since you are passing an object you only need one parameter as function input, and then access the values from it:

function getReviewPositivityScore (object) {
   return object.positive - object.negative;
}
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!