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

148
Views
Broma diciendo "No es una función" cuando se define como función

Estoy escribiendo una broma para esta simple función:

 function isVowel(ch) {
 ch = ch.toUpperCase();

 return ch == "A" || ch == "E" || ch == "I" || ch == "O" || ch == "U";
}

esta es la broma:

 const isVowel = require("./isVowel");
test("a is vowel", () => {
 const ch = isVowel("a");
 expect(ch).toBe("A");
});

al ejecutarse da error: TypeError: isVowel no es una función

¿como resolverlo?

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Supongo que escribe su código en formato commonjs debido a la forma en que lo require en su archivo de prueba, por lo que simplemente exporta así:

 // isVowel.js

function isVowel(ch) {
 ch = ch.toUpperCase();

 return ch == "A" || ch == "E" || ch == "I" || ch == "O" || ch == "U";
}

module.exports = isVowel;
almost 4 years ago · Santiago Trujillo 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!