题解 | #判断版本#
判断版本
http://www.nowcoder.com/practice/dcc4b011c86c454aa58cb1790a8cb760
解题思路: 现将两个字符串按照.分割, 然后把他们转化成数字,进行比较大小即可
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n </head>\n <body>\n \t\n <script type=\"text/javascript\">\n const _shouldUpdate = (oldVersion, newVersion) => {\n // 补全代码\n const list1= oldVersion.split('.').map(item=>Number(item)).join('')\n const list2=newVersion.split('.').map(item=>Number(item)).join('')\n if(list2>list1)return true \n return false \n \n }\n </script>\n </body>\n</html>","libs":[]}