Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to Convert Time String Type into Time Type in js
How to Convert Time String Type into Time Type in js
1. If the variable is a string, the plus sign of js will splice two or more strings into one.

2. In order for js to add or perform other operations on the data of variables, you can use parseInt to turn strings into integers.

3. If the string contains dots, the numbers after the dots will be directly ignored when the string is converted by parseInt. That is, take the whole number directly instead of rounding.

4. So for strings with dots, you can use parseFloat to convert them.

5, so you can use toFixed () to keep decimal places.

6. In this way, JS can get a more accurate digital result of two-digit operation.