I am actually procrastinating on my reading with JavaScript. I never thought I'd actually do that, but, hey, it's reading about blockchain or it's learning JavaScript, and... well... yep. Besides, I have, like, two more things to tackle in Objects, so I might as well get those over with, huh? Man, though, I gotta remember all the JavaScript I did before. Whoops. Displaying ObjectsSo when you create an object and then try to display it, JavaScript goes "Oh, hey, that should be a string," and the object goes "No, I'm an object". const pokemon = { name: "Magikarp", type: "Water", move: "Splash" }; let character = pokemon; document.getElementById("demo").innerHTML = character; Which means that, because the girls are fighting, you get [object Object] There are a few ways to make it behave. Displaying Object PropertiesThe easiest is, really, just displaying all the properties. const pokemon = { name: "Magikarp", type: "Water", move: "Splash" }; let character = pokemon.name + ", " +…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.