If (coinToss() === 'heads')


#1
Where am i goin wrong?


function coinToss() {
  // This function will randomly return either 'heads' or 'tails'.
  return Math.random() < 0.5 ? 'heads' : 'tails';
}

const pics = {
  kitty: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-kitty.jpg',
  doggy: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-puppy.jpeg'
};
let img;

// if/else statement begins here:
If (coinToss() === 'heads'){
   img = <img src={pics.kitty} />;
   }else{
   img = <img src={pics.doggy} />;
}




#2

oops!, forgot to wrap those img tags in jsx

if (coinToss() === ‘heads’) {
img = (

);
} else {
img = (

);
}


#3

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