Explore BrainMass
Share

Explore BrainMass

    Javascript - swapping 2 objects cyclically

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I have two lamps (blue and red). I know how to exchange them (to red and blue etc..)

    However I would like to have them both blue and with any button click I'd like them to change repeated cyclically: (blue,red), (red,blue), (red,red), then again (blue,blue)...

    I have been trying all kinds of loops but never got it to work.

    © BrainMass Inc. brainmass.com October 10, 2019, 5:07 am ad1c9bdddf
    https://brainmass.com/computer-science/javascript/javascript-swapping-two-objects-cyclically-493410

    Attachments

    Solution Preview

    Dear student,

    Please find the solution attached.

    Thanks,
    Kavita Narang

    (--Please ...

    Solution Summary

    This solution helps answer a question involving Javascript.

    $2.19