Commit 4bd7f716 authored by 李彥志's avatar 李彥志

update totalPrice() (change const to let & remove :void

parent ee30fbfc
......@@ -22,14 +22,14 @@ export class P2Component implements OnInit {
message = '';
buildMessage(): void {
if (this.name !== null && this.price !== null && this.quantity !== null &&
this.name !== undefined && this.price !== undefined && this.quantity !== undefined
) {
this.message = '你購買' + this.name + '商品,單價' + this.price + '元,數量'
+ this.quantity + '元,共計NT$';
}
}
// buildMessage(): void {
// if (this.name !== null && this.price !== null && this.quantity !== null &&
// this.name !== undefined && this.price !== undefined && this.quantity !== undefined
// ) {
// this.message = '你購買' + this.name + '商品,單價' + this.price + '元,數量'
// + this.quantity + '元,共計NT$';
// }
// }
addData(): void {
......@@ -48,10 +48,10 @@ export class P2Component implements OnInit {
}
totalPrice(): void {
const result = 0;
totalPrice() {
let result = 0;
for (
const i = 0; i < this.datas.length; i++
let i = 0; i < this.datas.length; i++
) { const data = this.datas[i];
result = result + data.total;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment