# Difficulty With Object Coding

**URL:** <https://forum.kirupa.com/t/difficulty-with-object-coding/643974>\
**Category:** Uncategorized\
**Created:** [August 25, 2020, 6:07pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974 "2020-08-25T18:07:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [August 25, 2020, 6:07pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/1 "2020-08-25T18:07:17Z")

</div>

```auto
var cars = {
    colors : ["black","blue","red","yellow"],
    style : "sleek",
    model : "Cadillac",
    wheels : {
        tires : "Goodyear",
        rims : "steel", }
};
textSize(25);
fill(18, 120, 105);
text("Cars, Cars and More Cars",10,25);
textSize(9);
text("This year's models are " + cars.style + " and come in " cars.colors[0] + " and "
 + cars.colors[1] + ".",10,15);

```

// the code was supposed to print out - Cars, Cars and More Cars (which it did) and  
This year’s models are sleek and come in black and blue (which it didn’t) - any idea of why this sentence didn’t print ?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 25, 2020, 6:15pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/2 "2020-08-25T18:15:26Z")

</div>

You’re missing a plus sign (`+`) after " and come in "

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [August 26, 2020, 3:03am UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/3 "2020-08-26T03:03:19Z")

</div>

John - you may find using the template literal approach outlined here to be easier and less error prone: [Combining Strings and Variables](https://www.kirupa.com/javascript/combining_strings_variables.htm)

😃

---

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [August 26, 2020, 4:12pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/4 "2020-08-26T16:12:19Z")

</div>

Ah … … I thought I was being so careful when I wrote the code - my proofreading skills obviously need sharpening - thanks for catching and pointing out the omission.

---

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [August 26, 2020, 4:25pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/5 "2020-08-26T16:25:00Z")

</div>

terrific - I will study the contents of the link provided - thanks

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 26, 2020, 4:29pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/6 "2020-08-26T16:29:17Z")

</div>

It can be hard to notice these things, especially when you’re still trying to familiarize yourself with the syntax.

Many editors nowadays will have, or can have via plugins, linters that will check your code for mistakes like this as you type. A popular one for JavaScript is ESLint. [Putting your code through that linter](https://eslint.org/demo#eyJ0ZXh0IjoidmFyIGNhcnMgPSB7XG4gICAgY29sb3JzIDogW1wiYmxhY2tcIixcImJsdWVcIixcInJlZFwiLFwieWVsbG93XCJdLFxuICAgIHN0eWxlIDogXCJzbGVla1wiLFxuICAgIG1vZGVsIDogXCJDYWRpbGxhY1wiLFxuICAgIHdoZWVscyA6IHtcbiAgICAgICAgdGlyZXMgOiBcIkdvb2R5ZWFyXCIsXG4gICAgICAgIHJpbXMgOiBcInN0ZWVsXCIsIH1cbn07XG50ZXh0U2l6ZSgyNS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HJvdWdoIjoyLCJuby1mdW5jLWFzc2lnbiI6Miwibm8tZ2xvYmFsLWFzc2lnbiI6Miwibm8taW5uZXItZGVjbGFyYXRpb25zIjoyLCJuby1pbnZhbGlkLXJlZ2V4cCI6Miwibm8taXJyZWd1bGFyLXdoaXRlc3BhY2UiOjIsIm5vLW1pc2xlYWRpbmctY2hhcmFjdGVyLWNsYXNzIjoyLCJuby1taXhlZC1zcGFjZXMtYW5kLXRhYnMiOjIsIm5vLW5ldy1zeW1ib2wiOjIsIm5vLW9iai1jYWxscyI6Miwibm8tb2N0YWwiOjIsIm5vLXByb3RvdHlwZS1idWlsdGlucyI6Miwibm8tcmVkZWNsYXJlIjoyLCJuby1yZWdleC1zcGFjZXMiOjIsIm5vLXNlbGYtYXNzaWduIjoyLCJuby1zaGFkb3ctcmVzdHJpY3RlZC1uYW1lcyI6Miwibm8tc3BhcnNlLWFycmF5cyI6Miwibm8tdGhpcy1iZWZvcmUtc3VwZXIiOjIsIm5vLXVuZGVmIjoyLCJuby11bmV4cGVjdGVkLW11bHRpbGluZSI6Miwibm8tdW5yZWFjaGFibGUiOjIsIm5vLXVuc2FmZS1maW5hbGx5IjoyLCJuby11bnNhZmUtbmVnYXRpb24iOjIsIm5vLXVudXNlZC1sYWJlbHMiOjIsIm5vLXVudXNlZC12YXJzIjoyLCJuby11c2VsZXNzLWNhdGNoIjoyLCJuby11c2VsZXNzLWVzY2FwZSI6Miwibm8td2l0aCI6MiwicmVxdWlyZS15aWVsZCI6MiwidXNlLWlzbmFuIjoyLCJ2YWxpZC10eXBlb2YiOjJ9LCJlbnYiOnt9fX0=) shows the error as a parsing error (if you look in the code, there’s a little red squiggly where the error is).

---

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [August 26, 2020, 5:07pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/7 "2020-08-26T17:07:49Z")

</div>

![Screen Shot 2020-08-26 at 10.04.47 AM](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/2/2c8f553f4018a6b6d3603c94a9e287e0d8dead3b.png)

Really ? I don’t see a little red squiggly in line 13 where the error is - on the other hand it does point out the error as being in line 13 and the 63 in 13:63 I assume stands for the position of the error in the line so that is pretty darn good

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 26, 2020, 5:15pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/8 "2020-08-26T17:15:16Z")

</div>

Ah interesting. Im using Chrome on Mac and the I see the squiggly

 ![image](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/d/daf59e61d250d32429608ba67e2c235f416847d9.png)

It also shows in [VS Code](https://code.visualstudio.com/).

 ![image](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/d/d8b42a169977dd60d1793f1e9f8b79fc98113953.png)

---

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [August 26, 2020, 8:35pm UTC](https://forum.kirupa.com/t/difficulty-with-object-coding/643974/9 "2020-08-26T20:35:40Z")

</div>

I’m using Safari so that could be the difference but at any rate Linter does identify the issue quite precisely so it’s very useful in that regard.
