• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Objects and Prototypes

 
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a few things that still are not clear - I think instead of just posting everything that isn't clear, I will start from the beginning, and hopefully once the questions at the beginning are answered the rest will make sense to me.

So my understanding is that everything apart from the primitives in Java is an object.

If I do:


=> object

This is what confuses me. We are creating a new Number. Surely the type should be Number (which is itself an Object).

Please can someone clarify this for me?

Thanks.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't confuse type with constructors. Those are all objects which just happen to have a constructor. If you create a constructor with the name Fred, the type of objects created via the constructor will still be objects, not Fred.
 
Bear Bibeault
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And no, Number is not an object. It is a function (constructor).

You really should pick up the MEAP for Secrets of the JavaScript Ninja which is getting ready for final publishing. It explains all of this in excruciating detail in Part II of the book
 
Bear Bibeault
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ahmed Bin S wrote:So my understanding is that everything apart from the primitives in Java is an object.



You meant JavaScript, I'm sure.
 
Ahmed Bin S
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, that makes sense now!

I think you should be a salesperson - you just flogged me your book!

I have played around with JS before to do client-side validation, but haven't ever delved in. I now want to expand my knowledge, I think the problem is that I have been trying to cut corners and I think reading a blog post here and a blog post there probably isn't the best way to go about it so I'll read the ninja cover to cover - I hope it can be done in 5 days as I have too much on my plate from next week onwards!

(Yes, I mean JS!)
 
Ahmed Bin S
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The MEAP doesn't list a link for an errata. I am assuming it will be proof-read by someone, but as I am reading the book cover-to-cover, should you wish I am happy to also point out any errors I come across, and then Manning's proof-readers can cross-check with that.

So far I have found the following:

the strict mode, which changes some JavaScript semantics, so that errors are thrown instead silently picked up [needs correcting] p5
This is why we’re going take a look at: [missing "to"] p34
 
Bear Bibeault
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ahmed Bin S wrote:The MEAP doesn't list a link for an errata. I am assuming it will be proof-read by someone,


As the book hasn't even been published yet, no errata. The book has been, and is continuing to be, reviewed by copy editors, technical editor, as well as peer review.

but as I am reading the book cover-to-cover, should you wish I am happy to also point out any errors I come across, and then Manning's proof-readers can cross-check with that.


Yes, there will be a place set up to report errata once published.

Thanks for the reports so far.
 
Ahmed Bin S
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as you’ve seen throughout this section, most of developer tools offer basically the same [missing "the"] p39
 
Ahmed Bin S
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, in that case I'll just make a note of them as I come across them and email them to you once I have finished the book.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic