Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Need help with some OO consctructor functions

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #249607
    damcel
    Participant

    The pen is very simple:

    http://codepen.io/damianocel/pen/pRzQoB

    I want to enter a name in the input field and then that name(let’s say it already exists, like andrea on line 8 in the JS code) is used to return the return value of the Person constructor and print it into the input field.

    Now, I am not even sure that return statement in the constructor is legal(it give no error at least), but maybe it would be better to add a method there?

    And how do I get that value that is returned into the input field. I know, it’s done by input.innerHTML += ???

    Something cached in a variable somewhere I suppose, this brings me back to that return statement, it just looks so wrong:-)

    A little aside, line 19 in the JS code does not work anymore, no idea why.

    Thanks ppl, really immediately before the breakthrough with this constructor function stuff:-)

Viewing 1 post (of 1 total)
  • The forum ‘Design’ is closed to new topics and replies.