When passing a value to the background, 0 is a text, 1 is an integer, and 2 is a floating point number. How can you tell what the current state is?

clipboard.png
three different states

        let data=[]
            var shuzhi= document.getElementsByTagName("input");
            for(var i=0;i<shuzhi.length;iPP){
                    var obj={
                    valueId: shuzhi[i].getAttribute("id"),
                    valueTime:time,
                    value: shuzhi[i].value,
                    valueType:valueType,
                    reportId:1
                }
                    data.push(obj);
            }

valueType 0 is text 1 is an integer 2 is a floating point number how can I tell?

Mar.04,2021

use typeof to determine character types


  1. / ^ [0-9] + $/
  2. shuzhi.indexOf ('.')

the rest are 0


doesn't understand what you're asking.
what do you mean by judgment?
according to the code you give now, valueType is already a definite value, and you can judge by valueType, or you need to derive valueType? according to some other values.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf6d61-32031.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf6d61-32031.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?