Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Has anyone done that challange in end of the video

So basically at the end of the video our cool dude over here asked us to try and create a way that will put the correct unit of mesurement depending on what country they are from US = sq ft EU = sq m

correct? Well i dont know wanted to play around really was tough at my part had a real struggle but finally found out that listen. console.log() is honestly youre best friend. and feel like i learn a lot more about the return variable which is nice as well as functions too. id reccomend to try it out tbh. But i did have my own twist i made it prompt the user where they are from choosing from US OR EU and if they didnt choose anything they would have to choose again. just have to say it was a struggle but was defiantly fun

let country = prompt("Are you from US or Europe");

let b = (country) => {
  if (country === "US") {
    country = "sq ft";
    return country;
  } else if (country.toUpperCase() === "EUROPE") {
    country = "sq m";
    return country;
  } else {
    alert("give me one of the two countrys plz find me @de_gentl3m4n");
  }
};

let m = b(country);

const getArea = (width, length, unit = m) => {
  const area = width * length;
  return `${area} ${unit}`;
};

console.log(getArea(12, 14));

i know its nothing cool but hey check it out let me know what you think and hey know whats up?