What wrong with my Code (Homework and New to coding )

Hello , I don’t know what is wrong with my code this si homework and I am coding on code.org pls help

this is the written code:

//Pick Job and Outfit colour
onEvent("pickJobScreen", "click", function( ) {
  playSound("sound://category_music/birthday_kazoo_positive_game_cue_1.mp3", false);}
 onEvent("dropdownJob", "change", function( ) {
    //base
    //There is a delay when the pictures change I am not sure why
    pickjob = getProperty("dropdownJob", "value");
    if (pickjob == "Clown") {
      setImageURL("baseCharacter", "clown-black.png");
    } else if((pickjob == "Juggler")) {
      setImageURL("baseCharacter", "hk-km-.png");
    } else if((pickjob == "Magician"))
      setImageURL("baseCharacter", "circus-clipart-magician-1.png");
   onEvent("dropdownColour", "change", function( ) {
    picksuitcolourclown = getProperty("dropdownJob", "value");
    if (picksuitcolourclown == "Pink") {
      setImageURL("baseCharacter", "clown-pink.png");
    } else if((picksuitcolourclown == "Green")) {
      setImageURL("baseCharacter", "clown-green.png");
    } else if((picksuitcolourclown == "Black")) {
      setImageURL("baseCharacter", "clown-black.png");
    }else if((picksuitcolourclown == "Blue")) {
      setImageURL("baseCharacter", "clown-blue.png");
    } else if((picksuitcolourclown == "Gold")) {
      setImageURL("baseCharacter", "clown-yellow.png");}
});

Can you explain what you want help with? In what way(s) is the code not meeting your needs/expectations?


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

This is a more detailed explanation

On code.org you are given an error message when something in your code doesnt work this is represented by a red square or yellow triangle
my error is not defined and the issue is on lines 30 and 53 I am not sure what the problem is here is a picture from the site and the written code

//Pick Job and Outfit colour
onEvent("pickJobScreen", "click", function( ) {
  playSound("sound://category_music/birthday_kazoo_positive_game_cue_1.mp3", false);}
 onEvent("dropdownJob", "change", function( ) {
    //base
    //There is a delay when the pictures change I am not sure why
    pickjob = getProperty("dropdownJob", "value");
    if (pickjob == "Clown") {
      setImageURL("baseCharacter", "clown-black.png");
    } else if((pickjob == "Juggler")) {
      setImageURL("baseCharacter", "hk-km-.png");
    } else if((pickjob == "Magician"))
      setImageURL("baseCharacter", "circus-clipart-magician-1.png");
   onEvent("dropdownColour", "change", function( ) {
    picksuitcolourclown = getProperty("dropdownJob", "value");
    if (picksuitcolourclown == "Pink") {
      setImageURL("baseCharacter", "clown-pink.png");
    } else if((picksuitcolourclown == "Green")) {
      setImageURL("baseCharacter", "clown-green.png");
    } else if((picksuitcolourclown == "Black")) {
      setImageURL("baseCharacter", "clown-black.png");
    }else if((picksuitcolourclown == "Blue")) {
      setImageURL("baseCharacter", "clown-blue.png");
    } else if((picksuitcolourclown == "Gold")) {
      setImageURL("baseCharacter", "clown-yellow.png");}
});

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

There’s an unclosed / unmatched curly brace.

Try your code here

3 Likes

It definitely appears to me that you’re missing your closing curly brace on line 53 from your onEvent from line 30.

1 Like

hi im stuck trying to get the correct code am at this stage

Copyright Cat Photo App

Jump to Bottom

and cant get it all correct …it give the following errors

The a tag should have an href attribute set to “#footer”.

The a tag should not have a target attribute

The a text should be “Jump to Bottom”.

The footer tag should have an id attribute set to “footer”.

can anyone please point me in the direction to get it right

Copyright Cat Photo App

Jump to Bottom>

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

thanks will try it now and see how it goes