Is there a reason console.log() is non-response - I can’t establish whether my code is right because I can’t get results from my console. Been trying all day and have got nothing, is there something obvious that I am missing?
function makeClass() {
"use strict";
/* Alter code below this line */
class Thermostat {
constructor (farenheit) {
this.farenheit = farenheit;
}
get temperature () {
return 5/9 * (this.farenheit - 32);
}
set temperature (celsius) {
this.temperature = celsius * 9. / 5 + 32;
}
}
/* 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
console.log(temp);
class Thermostat {
// creates the properties that the class will take
constructor(fahrenheit) {
this.fahrenheit = fahrenheit;
}
// makes a function to take input and convert to using formula
toCelcius(fahrenheit) { // make method to convert your number
let celcius = (fahrenheit - 32) * 5 / 9;
return Math.round(celcius); // rounds to nearest integer
// return celcius; // returns full number instead
}
}
const temperature= new Thermostat() // create new object
let temp = temperature.toCelcius(76) // use the method created in your class object
console.log("temp = " + temp + "*C") //