Challenge 7 Megathread

Welcome to challenge #7!

Use this thread for any and all questions relating to challenge 7

I used to convertion suggested in the hint tab and it worked for me. Just don’t forget to round values you converted.

It says I returned a function instead of an object for the last test run, and Google isn’t helping. What does this mean?

post a snippet of your code

storeWeatherConditions.windDirection = windDirection;

return storeWeatherConditions;

Well it IS a function. All of these challenges start with a predefined function. You need to define an object inside the function and then return the object, inside the function (inside the last curly bracket.)

I am having an issue with something not defined in the challenge. All of my numerical values pass the test but for conditions, if I put Cloudy, it says it is expecting Sunny with small clouds and vice versa
`Expected: Sunny with small clouds

Actual: Cloudy`
I could write code to exchange one for the other but it doesn’t make sense to me. It’s not in the challenge description.

OK, I didn’t know that. Thanks!

You don’t want to define the ‘conditions’ or any of the variables, let the input dictate that. You should be creating an object to pull the information from the function inputs, giving those values to your object as properties, converting the numbers in the properties with the formulas provided and then returning the object with the conversions completed


This one was not too easy ! I still like it !
I had to do a bit of research to find the right formulas.

That was so silly, I just removed the conditions line and it passed. Thank you!

Gotta love built in math functions, so quick and easy. My only issue on this one was how to build an object, I was mixing up the methods. Other than that, it was smooth going.

Will take you more than one line of code :wink: Also, feel free to name your object whatever you like!

if you check the variables given via

console.log(temperature, condition, windSpeed, windDirection);
you’ll see that 80 lol

I think I am missing something straightforward, I created a new object, but when I console.log and return all that runs is the first item, temperature: 0. I have gone through all information about returning all keys/values, as well as using ‘for’, and I’ve tried so many things but maybe I am misunderstanding some of the terms. Can anyone help with even a vague hint of the direction I need to go in?

const storeWeatherConditions = (temperature, condition, windSpeed, windDirection) => {
 temp = ("temperature: " + Math.round((temperature - 32) * 5 / 9));
 windSp = ("windspeed: " + Math.round(windSpeed / 2.237));
 cond = ("condition: " + condition);
 windDir = ("windDirection: " + windDirection);
 const weather = new Object(temp, windSp, windDir, cond); 


hey folks! I’m a bit stuck on this challenge. I am passing only the first test. Here is my code:

const storeWeatherConditions = (temperature, condition, windSpeed, windDirection) => {
  // Code here!
  let weather = [temperature, condition, windSpeed, windDirection];
  weather.temperature = Math.round((weather.temperature - 32) * 5/9);
  weather.windSpeed = Math.round(weather.windSpeed/2.237);
  weather = Object.keys(weather);
  return weather;
  // Remember to return an object!

The two tests I fail are:

The storeWeatherConditions function should return a all the proper keys


The storeWeatherConditions function should return all the proper values

I feel I might be okay once I get the keys to pass properly, but it does not seem to be working. Any suggestions? thank you!

your syntax is a little off… check your variable definitions… even though JS will make some assumptions and assume they are vars, also think about what your are assigning to each variable… is it key and then value or is it a string?

Your weather variable is assigned as array, must be returned an object.

Thanks very much! :smiley: that is where I suspected where my problem might lie, in the understanding of keys/values vs strings. Ok back to it again!

You defined your ‘weather’ variable as an array not object. Tip: use curly brackets instead of square.