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

289
Views
¿Cómo invoco una función cuando uso inquirer?

Estoy construyendo un juego de 'acorazado' CLI de nodo. Inicialmente, un usuario ingresa coordenadas que se almacenan en las variables xCoordinate y xCoordinate . Esto se maneja usando inquirer :

índice.js

 import inquirer from 'inquirer' //write a function that takes in user coordinates const question1 = [ { type: "input", name: "x-coordinate", message: "Please enter the first of two coordinates", }, { type: "input", name: "y-coordinate", message: "Please enter the last coordinate", }, ]; let xCoordinate; let yCoordinate; inquirer.prompt(question1).then((answers) => { let xCoordinate = answers["x-coordinate"]; let yCoordinate = answers["y-coordinate"]; console.log( `You have entered [${xCoordinate}, ${yCoordinate}] as your coordinates` ); });

Tengo una función screenForShips que compara las coordenadas ingresadas con una matriz que contiene los "barcos" y le dice al usuario si tiene un acierto o no.

Entonces, mi pregunta es esta: en inquirer , ¿cómo se invoca la función screenForShips después de recibir información de un usuario?

about 4 years ago · Juan Pablo Isaza
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!