Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

45
Vistas
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)

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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;
}
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos