Day 2: Objects
-
-
betkom Asked to answer 9 years ago Endorsed by _mohitgargYou are not supposed to create any variable. An object called myObject has been created and has been given it's fields and their respective values. The only thing you need to do is print out the object in the function 'printObjectProperty', the object is the argument passed into the 'printObjectProperty' function. Let me know if this helps.
-
kropen 5 years ago This is not correct, because mere printing of the object passes as correct answer but fails two test cases, which is never clarified.
-
-
sarbazx Asked to answer 9 years ago just myObject
-
shalinisinghsss4 9 years ago Exactly
-
-
shtolcers 9 years ago Agreed, instructions are not clear enough for task with so much additional code.
btw. wt*f is // tail starts here
-
PRASHANTB1984 9 years ago You just need to log myObject directly - or you may construct the string by throwing together the brace brackets and the attributes of the objects. It is seriously just as simple as that. Part of such tutorials is just reading the code itself, so that you get an idea of what is happening and how we're setting the values contained in the object.
-
paul_bissex 9 years ago The problem is, this is bad pedagogy. From earlier challenges we are used to some boilerplate code below what we are supposed to type. There's no indication that reading this code is part of the challenge. For the solution here to be a single console.log line is absurd. Success on this one is about solving the puzzle posed by the unclear presentation.
-
VeryThorough 9 years ago I agree, this challenge is very poorly written. The task clearly states, "Assign these values to an object car that has the properties type, model and color appropriately and print the object," but this is not the actual task. "Print the object that has been created for you" is more accurate.
Beyond that, nowhere in the intro text do you explain how objects are output to the console, so new users will have no reason to think that simply using console.log(myObject) will produce the desired string. Instead you explain how to access the properties of an object, but don't incorporate that learning into the task!
A task more appropriate to the intro would be to use the object created in the starter code and print the color of the car, for example. This would still require reading of the code, but the user would know this from the task description, and they would actually have to apply a new concept in printing an object property, rather than just treating an object like it's just another variable.
-
verapi03 9 years ago Totally agree.
-
-
deirdre9 9 years ago I also agree that this question was not well introduced. Part of the reason I'm doing this challenge is that I've struggled with HackerRank assessments that have been sent to me as a tech screen when interviewing for jobs and I've often struggled with them not because I don't know JavaScript but because of confusing questions or a weird/unexpected way of running the code.
-
_mohitgarg 9 years ago Exactly i was recently doing project euler challanges it keeps giving me error although my code was working perfectly on repl.it.
-
medianocturne1 9 years ago I love Project Euler challenges, I do them at work when I'm between projects, so much fun!
-
-
ngdana1 9 years ago Agreed, I usually get JavaScript, but canot understand sometimes what is expected in the Hackerrank challenges half the time.
-
wingardc 9 years ago Yes! Agreed! This challenge wasn't very clearly laid out, especially considering it's meant for beginners. But this seems to be a recurring theme on this site.
-
-
-
-
Instructions are not clear what do i need to log car or myObject. if i need to log myObject what do i do with varaible car then. I m really confused. This simple challange is sucking up all my time!!
Add Reply Preview cancel