Created
June 17, 2018 09:23
-
-
Save cyrusthecool/32beb140f74df78333b2a18e8e70773e to your computer and use it in GitHub Desktop.
cashRegister without function
This file contains hidden or 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
// 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