JavaScript 判断变量是否为空---三元运算,元组获取值-重组.map()。
var from_days = getQueryString('from_days'); undefined {'from_days': (from_days) ? from_days : null} {from_days: null} var from_hours = getQueryString('from_hours') undefined {'from_days': (from_hours) ? from_hours : null} {from_days: "1"}
cpu_data = [['11:02:42', 12.3], ['11:02:47', 11.4], ['11:02:52', 13.3], ['11:02:57', 9.5], ['11:03:02', 12.6], ['11:03:07', 9.2]] (6) [Array(2), Array(2), Array(2), Array(2), Array(2), Array(2)] time_list = cpu_data.map(item =>item[0]) (6) ["11:02:42", "11:02:47", "11:02:52", "11:02:57", "11:03:02", "11:03:07"]
.map() 应用https://www.jb51.net/article/150818.htm
变量赋值时的三元运算写法
var host = window.location.host; //127.0.0.1 var proto = window.location.protocol; var ws_proto = (proto === "http:" ? "ws:" : "wss:");
posted on 2019-09-24 15:24 zhangmingda 阅读(1899) 评论(0) 编辑 收藏 举报