Skip to content

Instantly share code, notes, and snippets.

@cyrusthecool
Created June 17, 2018 09:23
Show Gist options
  • Save cyrusthecool/32beb140f74df78333b2a18e8e70773e to your computer and use it in GitHub Desktop.
Save cyrusthecool/32beb140f74df78333b2a18e8e70773e to your computer and use it in GitHub Desktop.
cashRegister without function
// without function
//extract Array from Object
const cartArray = Object.values(cartForParty);
console.log(cartArray);
//converting data type string to number
cartArrayNum=[];
cartArrayNumValue = 0 ;
for (let i = 0; i < cartArray.length; i = i + 1) {
cartArrayNum[i] = Number(cartArray[i]);
//accumlating the array of number values
cartArrayNumValue += cartArrayNum[i];
};
console.log(cartArrayNum);
console.log(cartArrayNumValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment