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

73
Views
Cómo agregar 2 cadenas en una matriz condicionalmente e imprimir esos valores uno debajo del otro

tengo una matriz que inicialmente está vacía, luego puse algunas condiciones e imprimí esos elementos

 const myItems= [] -----other code goes here myItems = someCondition : "A B" : "A"

si someCondition es verdadera, debería verse como uno u otro hacia abajo

 "A" "B"

más

 "A"
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

simplemente podrías hacer esto:

 const myItems = []; myItems.push((condition ? "A B" : "A").splite(" "));
about 4 years ago · Juan Pablo Isaza Report

0

Simplemente presione una de las expresiones.

 const items = []; items.push(condition ? 'AB' : 'A');
about 4 years ago · Juan Pablo Isaza Report

0

Podrías usar esto:

 var myItems = []; let someCondition = Math.random() > 0.5; myItems = someCondition ? "AB" : "A"; myItems.split(' ').forEach(e => console.log(e));

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!