• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

155
Views
Cómo escribir JSON en empalme

Actualmente intento empalmar una matriz una por una hasta que esté vacía. Me pregunto si agrego JSON, ¿funcionará? ¿O hay alguna otra forma de empalmar una matriz una por una por intento? A continuación se muestra mi guión.

 var promoCode = ''; var bg1 = 'https://cdn.pixabay.com/photo/2020/06/01/22/23/eye-5248678__340.jpg'; var bg2 = 'http://farm5.static.flickr.com/4017/4717107886_dcc1270a65_b.jpg'; var bg3 = 'http://images6.fanpop.com/image/photos/41500000/adorable-puppies-cute-puppies-41538743-590-393.jpg'; var bgArr = [bg1, bg2, bg3]; for(var i = bgArr.length-1;i>=0;i--){ selectBG = bgArr.splice(Math.floor(Math.random()*bgArr.length), 1)[0]; console.log(selectBG); } if (selectBG === bg1) { promoCode = 'SCRATCH400'; } else if (selectBG === bg2) { promoCode = 'SCRATCH500'; } else if (selectBG === bg3) { promoCode = 'SCRATCH600'; } else if (bgArr.length === 0) { alert("No more voucher, back to main website"); window.location = 'https://www.google.com/'; }

over 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!