Created
September 30, 2014 14:26
-
-
Save siddharth-pandey/2ec1a29af844dcfc22cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var array = []; | |
var instance = $(this); | |
array.push(getAnArrayItem(instance.val(), "1", "123.89")); //pass the values either by using harcode d values or from a input... | |
// function to use to get an item to push | |
var getAnArrayItem = function(product, quantity, price){ //parameters to construct an item | |
var item = null; | |
if(product && quantity && price) //these can be based on you requirements as some propeties is not mandatory | |
{ | |
item = { | |
product: product, | |
quantity: quantity, | |
price: price | |
}; | |
} | |
return item; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment