i tried returning the final result but it won’t let me.. not sure what to do here
function helloWorld (hello,world) {
this.hello = hello;
this.world = world;
};
let a = new helloWorld("Hello, ","World!")
a.hello + a.world;
i tried returning the final result but it won’t let me.. not sure what to do here
function helloWorld (hello,world) {
this.hello = hello;
this.world = world;
};
let a = new helloWorld("Hello, ","World!")
a.hello + a.world;
What you did here is wrong,instead,you have two options:
1)(The regular way):
Pass a variable and return it:
function helloWorld(str){
str="hello world"
return str;
}
let hw=helloWorld(hw);
console.log(hw); //prints hello world
function helloWorld(a){
a.hello="hello";
a.world="world";
}
let hw={};
helloWorld(hw);
console.log(hw.hello+" "+hw.world); // prints hello world
dude yours doesn’t work… the challenge says no using of raw strings
if you can’t use strings, you could use numbers! there are the methods to change character codes to characters
yeah i was literally thinking about charcode 5 seconds ago
const helloWorld = () => {
let final = String.fromCharCode(72 , 101 , 108, 108, 111 , 44 , 32 ,87, 111, 114 , 108 , 100, 33)
return final;
};
helloWorld()
// 72 , 101 , 108, 108, 111 , 44 , 32 ,87, 111, 114 , 108 , 100, 33
im glad fromcharcode gives as many arguments as i could give.