Advanced JSX part 10 / 18

Hello guys,

I’am stuck with the if/else statement:

here is my code:

if (coinToss() == ‘heads’) {
var img = img src={pics.kitty} />;
} else {
var img = img src={pics.doggy} />;

I have delete < before img tag for this post.

Render is done, but step one is not validate.

If you have any suggestion ? :wink:

I believe a piece of the instructions is missing.

You first have to create the variable pics,
then type the values (kitty & doggy) with the correct paths where the images are located.
After, type your if/else statement that includes those properties that now exist.

Step one should validate.


var someImage = {
   pic1: './path/to/image',
   pic2: './another/path/to/image',
   pic3: './some/path/to/image'

if (...) {
var pic = <img src={someImage.pic1} />;
} else { 
var pic = <img src={someImage.pic2} />;


I believe there is a bug here because when I submit my code the only variation is in my code and their solution is a space after my condition in my if and the bracket and a line break before else

if(…) {

else {


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.