JavaScript for loop and array

Why all values on return are the same (16)["F", 0, 0, 0, 0, 0] and on console.log(color) I am getting 16 different hex colors :S

let color = [0, 0, 0, 0, 0, 0];
let colors = [];

for (let a = 0; a < 16; a++) {
  let x = 0;

  switch (a) {
    case 10:
      x = "A";
    case 11:
      x = "B";
    case 12:
      x = "C";
    case 13:
      x = "D";
    case 14:
      x = "E";
    case 15:
      x = "F";
      x = a;

  color[0] = x;


191 thoughts on “JavaScript for loop and array”

  1. Hello, I think your site might be having browser compatibility issues.

    When I look at your website in Firefox, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give
    you a quick heads up! Other then that, terrific blog!

  2. Whats up this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to
    manually code with HTML. I’m starting a blog soon but have no coding experience so
    I wanted to get guidance from someone with experience.
    Any help would be greatly appreciated!

    Also visit my homepage :: lpe88apk

  3. I just like the helpful info you provide in your
    articles. I will bookmark your blog and test again right
    here regularly. I’m slightly certain I’ll be told a lot of new stuff proper
    right here! Best of luck for the following!

    Also visit my web-site rollex11 apk ios download, Isiah,

  4. Hey there I am so thrilled I found your blog page, I really found you by accident, while I was searching on Aol for
    something else, Regardless I am here now and would just like to say thanks a lot for a remarkable post and a all round interesting blog (I also love the theme/design), I don’t have
    time to read through it all at the minute but I have bookmarked it
    and also added your RSS feeds, so when I have time I will be
    back to read much more, Please do keep up the awesome work.

    Feel free to visit my web blog Gay

  5. Hello there, I found your site via Google whilst
    looking for a related subject, your web site got here up, it seems
    to be good. I have bookmarked it in my google bookmarks.[X-N-E-W-L-I-N-S-P-I-N-X]Hello there, just turned into aware of your weblog via Google, and
    located that it’s truly informative. I am gonna be careful
    for brussels. I will appreciate in the event you proceed this
    in future. Many people will likely be benefited out of your writing.

    Have a look at my website … 3DS Keto

  6. Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I will come back once again since i have saved as
    a favorite it. Money and freedom is the best way to change, may you
    be rich and continue to help other people.

    Here is my web blog: Renown CBD Oil

  7. This design is spectacular! You obviously know how to
    keep a reader entertained. Between your wit and your videos, I was almost moved to start
    my own blog (well, almost…HaHa!) Great job.
    I really loved what you had to say, and more than that, how you presented it.
    Too cool!

  8. I just like the helpful info you provide on your articles.

    I will bookmark your blog and test once more right here regularly.

    I’m reasonably certain I’ll be informed many new stuff proper here!

    Good luck for the following!

  9. You really make it seem so easy with your presentation but I find
    this matter to be really something that I think I would never understand.
    It seems too complex and very broad for me. I’m looking forward for your next post, I will try to
    get the hang of it!

  10. hey there and thank you for your information – I have definitely picked up something new from
    right here. I did however expertise some technical points using this website, since I experienced to reload the website a lot of times previous to I could get it to load correctly.
    I had been wondering if your web host is OK?
    Not that I’m complaining, but sluggish loading instances times will sometimes affect your
    placement in google and could damage your high quality score if
    ads and marketing with Adwords. Anyway I am adding this RSS to my email
    and could look out for much more of your respective interesting content.
    Make sure you update this again soon.

  11. I’ve been exploring for a bit for any high-quality articles or weblog posts in this kind of house .
    Exploring in Yahoo I at last stumbled upon this web site.
    Reading this information So i am satisfied to show that I’ve a very excellent uncanny
    feeling I discovered exactly what I needed. I most certainly will
    make certain to don?t overlook this website and give it a glance
    on a continuing basis.

    Take a look at my web page –

  12. What i do not understood is in reality how you’re now not actually much more neatly-liked than you might be right now.
    You’re so intelligent. You realize therefore considerably
    on the subject of this subject, made me for my
    part consider it from a lot of numerous angles. Its like men and
    women are not involved except it’s one thing to do with Girl gaga!
    Your personal stuffs outstanding. At all times deal with it up!

    my site

  13. I was wondering if you ever thought of changing the layout of your site?
    Its very well written; I love what youve got to say. But maybe
    you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having one or
    2 pictures. Maybe you could space it out better?
    cheap flights cheap flights

  14. Hi, I do think this is an excellent blog. I stumbledupon it 😉 I’m going to come back yet again since i have book marked it.
    Money and freedom is the best way to change,
    may you be rich and continue to help other people.

    my web-site –

  15. This is really interesting, You’re an overly skilled blogger.

    I have joined your feed and look forward to in the hunt for more of your magnificent post.
    Additionally, I have shared your site in my social networks


Leave a Comment