Explore BrainMass

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


    Solution Preview

    Dear student,

    Please find the solution attached.

    Kavita Narang

    (--Please ...

    Solution Summary

    This solution helps answer a question involving Javascript.