I'm new to objects in javascript. Read up on this topic on https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript and got a little confused.
I don't understand the difference between functions and objects. On the one hand, function is supposed to be and instance of Function (which is a child of Object) and so a function is also supposed to be an Object.
On the other hand object itself is denoted as a key-value pair, such as:
var User = {name:"Tomy", password:"secret"}
and this is quite different from a function definition in terms of code compatibility...
Can I create function isn two different ways?
var User = function () {this.name="Tomy"; this.password="secret";}