Tell us what’s happening:
I only used the class keyword without the constructor method. I don’t think it should accepted as passed. For some reason this code passes.
Maybe some introduced a bug in to it.
Your code so far
function makeClass() {
"use strict";
/* Alter code below this line */
class Thermostat {
}
/* Alter code above this line */
return Thermostat;
}
const Thermostat = makeClass();
const thermos = new Thermostat(76); // setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.
I just checked the tests for this challenge. It seems they just check if there is a class defined as source level, and other tests are based on output.
I’m not JS expert, but seems JS/ES is not strict enough, and you can just have a field of an object at runtime created.
If you put console.log(thermos.temperature); after line thermos.temperature = 26;, you confirm.
I’m going to report this bug on FCC github page(or you can do it too dear), and hope soon they could push an update with better testing.
Thanks again for reporting it, Keep going on great work, happy programming.
Thank you so much for reporting possible issues you may please create a new post, and specify the faulty code could pass the test? just like this one you did it very good.