Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 解析最后8个字符并将其存储在另一个变量中。这是我到目前为止所拥有的_Javascript_Parsing_Startswith - Fatal编程技术网

Javascript 解析最后8个字符并将其存储在另一个变量中。这是我到目前为止所拥有的

Javascript 解析最后8个字符并将其存储在另一个变量中。这是我到目前为止所拥有的,javascript,parsing,startswith,Javascript,Parsing,Startswith,在SCCM中,我们为许多不同的计算机提取序列号(变量为序列号)。我试图做的是,如果被拉取的变量以1S开始,则将其存储在另一个变量中。Javascript非常新,因此任何帮助都将非常有用 var serial_number = '1S10B60008USMG001S68' //replace with variable Serial_number coming from SCCM. //right now ''1S10B60008USMG001S68' is hard coded would

在SCCM中,我们为许多不同的计算机提取序列号(变量为序列号)。我试图做的是,如果被拉取的变量以1S开始,则将其存储在另一个变量中。Javascript非常新,因此任何帮助都将非常有用

  var serial_number = '1S10B60008USMG001S68' //replace with variable Serial_number coming from SCCM. //right now ''1S10B60008USMG001S68' is hard coded would like that replaced with a variable and to test it display output
        
        if (serial_number.startsWith('1S')) {
          
         var serial_numberLenovo = (serial_number.slice(-8));
         console.log(serial_numberLenovo)
          
    }

我想出来了,我不知道如何结束这一切