hi ive created visual calc using html and its looks like this ..
| 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | | . | |
and ive created function called number()
on click on each html element
and this is it
number(number) { this.total_quantity_discount_price = this.total_quantity_discount_price+''+number; this.total_quantity_discount_price = parseFloat(this.total_quantity_discount_price); },
with numbers 0123456789
everything is working fine but my problem with the .
how can i add .
to this.total_quantity_discount_price
i mean how can i add the number 10.555 or 55.648 ect ..
thanks ..
Advertisement
Answer
Use Number
constructor like
this.total_quantity_discount_price = Number(this.total_quantity_discount_price+''+number);
let n=Number(4+'.'+5) // the n is a number which you could add it to another console.log(n) console.log(n+1) console.log(n-3)