Sort 50 Discussions, By:

Sorry, you do not have a permission to answer to this question.

  • dherran 9 years ago + 1 comment

    If the point was to learn objects why are we only being asked to console.log() something that is already set? You first say you are giving a single line that had to be put in an object. I though I had to split the string and save each column into the object. Instructions are not clear at all.

    Add Reply Preview cancel

    Sorry, you do not have a permission to answer to this question.

    • PRASHANTB1984 9 years ago + 3 comments

      See this isn't a usual challenge - it is also a tutorial. So, we handled the part where the string is split. Reading code is also a part of the learning. For someone completely new to programming this is quite essential.

      Add Reply Preview cancel

      Sorry, you do not have a permission to answer to this question.

      • jeancochrane 9 years ago + 1 comment

        You're definitely right that learning to read through code is essential, Prashant. At the same time, a hint telling us to read the code would have helped keep the focus on the lesson, rather than on aimless debugging – I agree with Paul's comment below, in that the previous challenges had trained us to ignore the code beneath our active functions. It was a little bit confusing, although not the end of the world. Anyway, thanks for helping me solve this one!

        Add Reply Preview cancel

        Sorry, you do not have a permission to answer to this question.

        • ibsavage 9 years ago + 0 comments

          IMHO, it would have been a better introduction of objects if the instructions were to print out myObject's properties individually.

          Add Reply Preview cancel

          Sorry, you do not have a permission to answer to this question.

        • Neurovibes 9 years ago + 0 comments

          Nowhere in the tutorial does it indicate the idea of creating a function that has no name... so in the part where it says "process.std.in(end'', function() {.. etc" ------------------------------------------------------------------------You create a variable called var myObject = new Object
          So this "new Object" is it the default referral to the no-named function listed at the first line, i.e. "..., function () {" ? does that mean "Object" is a reserved keyword?

          Add Reply Preview cancel

          Sorry, you do not have a permission to answer to this question.

          • Jancl0 9 years ago + 0 comments

            reading and understanding someone elses code is important, but the task suggests that we had to create the object ourselves

            Add Reply Preview cancel

            Sorry, you do not have a permission to answer to this question.

        • cristianlatapiat 8 years ago + 1 comment

          This is the solution!! :)

          function printObjectProperty(myObject) { //Write your code here console.log(myObject); }

          // The below code is to show how to create an Object. process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; });

          process.stdin.on("end", function () { var obj = _input.split(' '); var myObject = new Object;

          // Fill up the question marks
          myObject.type = obj[0]
          myObject.model = obj[1]
          myObject.color = obj[2]
          
          printObjectProperty(myObject);
          

          });

          image

          Add Reply Preview cancel

          Sorry, you do not have a permission to answer to this question.

          • vinayprajapati31 3 years ago + 0 comments

            Thank you so much

            Add Reply Preview cancel

            Sorry, you do not have a permission to answer to this question.

          • _mohitgarg 9 years ago + 3 comments

            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

            Sorry, you do not have a permission to answer to this question.

            • betkom Asked to answer 9 years ago + 1 comment
              Endorsed by _mohitgarg

              You 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.

              Add Reply Preview cancel

              Sorry, you do not have a permission to answer to this question.

              • kropen 5 years ago + 0 comments

                This is not correct, because mere printing of the object passes as correct answer but fails two test cases, which is never clarified.

                Add Reply Preview cancel

                Sorry, you do not have a permission to answer to this question.

              • sarbazx Asked to answer 9 years ago + 1 comment

                just myObject

                Add Reply Preview cancel

                Sorry, you do not have a permission to answer to this question.

                • shalinisinghsss4 9 years ago + 0 comments

                  Exactly

                  Add Reply Preview cancel

                  Sorry, you do not have a permission to answer to this question.

                • shtolcers 9 years ago + 0 comments

                  Agreed, instructions are not clear enough for task with so much additional code.

                  btw. wt*f is // tail starts here

                  Add Reply Preview cancel

                  Sorry, you do not have a permission to answer to this question.

                • redhatcoder 9 years ago + 1 comment

                  this is no different from second challenge of day 1!

                  Add Reply Preview cancel

                  Sorry, you do not have a permission to answer to this question.

                  • PRASHANTB1984 9 years ago + 1 comment

                    it isn't, but the idea is to introduce people to objects without throwing in too many new things into the picture

                    Add Reply Preview cancel

                    Sorry, you do not have a permission to answer to this question.

                    • pathaksidd 9 years ago + 0 comments

                      I'm very much familiar with programming but even I was very confused at first. Yes, the instructions here weren't clear at all, it was all just thrown on face to write console.log() where you get confused at first thinking "Is this really what you want??"

                      Add Reply Preview cancel

                      Sorry, you do not have a permission to answer to this question.

                  • giacgbj 9 years ago + 2 comments

                    I just wrote:

                    console.log(myObject);
                    

                    and it works, but that's not what the problem asked for.

                    I'm a bit confused :-D

                    Add Reply Preview cancel

                    Sorry, you do not have a permission to answer to this question.

                    • mariusgarbea 9 years ago + 2 comments

                      it's right. you already have your type, model, color fields of myObject assigned.

                      Add Reply Preview cancel

                      Sorry, you do not have a permission to answer to this question.

                      • giacgbj 9 years ago + 1 comment

                        The task is:

                        Assign these values to an object car that has the properties type, model and color appropriately and print the object.
                        

                        There's no object "car" in the code provided (it's called "myObject") and I have nothing to assign, because it's already assigned.

                        I call it confusing, because the interesting part of the task is already solved at lines 14-18 and you have only to print the result. It's not different from the "Hello World!" of the firsta day.

                        Add Reply Preview cancel

                        Sorry, you do not have a permission to answer to this question.

                        • mariusgarbea 9 years ago + 0 comments

                          well, here's my function. it is redundant but does what they want

                          function printObjectProperty(myObject) {
                              var car = {type:myObject.type, model:myObject.model, color:myObject.color};
                              console.log(car);
                          } 
                          

                          Add Reply Preview cancel

                          Sorry, you do not have a permission to answer to this question.

                        • medianocturne1 9 years ago + 0 comments

                          The reflex move is to 'define a new object for yourself, and call it 'car', then log 'car' to the console. This is what everyone seems to have expected. For some reason, this is not what they wanted. They apparently wanted to a) confuse new coders who, up until now, felt pretty good about things; and b) have new coders somehow glean from the provided code how object properties are assigned via that function/proto.. and then log to console said object, which is NOT called car, despite what you were told.. but a generic myObject.. The HRank guy said, 'we wanted to show Objects w/o throwing too much at new coders'.. they did the opposite by confusing the new coder, and never having mentioned functions (not to mention anonymous ones) OR prototypes. Not shocking this forum is filled to the brim. That should be all the proof HRank needs that they should revise this question.

                          Add Reply Preview cancel

                          Sorry, you do not have a permission to answer to this question.

                        • gbrova 9 years ago + 0 comments

                          I agree, the instructions are confusing! Looks like the prepopulated code already solves the problem for us, at lines 14-18.

                          Add Reply Preview cancel

                          Sorry, you do not have a permission to answer to this question.

                        1. Challenge Walkthrough
                          Let's walk through this sample challenge and explore the features of the code editor.1 of 6
                        2. Review the problem statement
                          Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
                        3. Choose a language
                          Select the language you wish to use to solve this challenge.3 of 6
                        4. Enter your code
                          Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
                        5. Test your code
                          You can compile your code and test it for errors and accuracy before submitting.5 of 6
                        6. Submit to see results
                          When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
                        1. Check your score