Q:

javascript - class with data how to load

Im trying to model a product in javascript:
var Product = {};
Product.getSku = function() {
    return this.sku;
}
Product.getPrice = function() {
    return this.price
}
Product.getName = function() {
    return this.name
}
module.exports = Product;

What is the correct way to create this object with the required properties?
Im coming from an oop background, am I thinking of js wrong?

A:

How would you do in in OOP?
You'll probably have these choices:

Via setters (you've already got getters).
Via constructor.
Via fields directly.

The first and the last are obvious.
In the second you'll probably do something like:
var Product = function(sku, price, name) {
    this.sku = sku;
    this.price = price;
    this.name = name;
}

var product = new Product(1, 2.34, "FiveSix");

A variation of this would be to pass an object as a single parameter:
var Product = function(data) {
    var productData = data || {};
    this.sku = productData.sku;
    this.price = productData.price;
    this.name = productData.name;
}

