javascript一行代码

//计算两个日期间的差值
const dayBetween = (date1,date2) =>
Math.ceil(Math.abs(date1-date2)/1000/60/60/24)
var d1 = new Date("2022-7-16")
var d2 = new Date("2022-1-16")
var d = dayBetween(d1,d2)
console.log(d)


//通过分隔符,分割字符串,然后计数
const characterCount = (str,char) => 
str.split(char).length - 1
char = " "
str = "I am a teacher,form Cangzhou Medical scool"
console.log(characterCount(str,char))

//重定向到另一个URL
const redirect = URL => location.href = URL
url = "http://cnliutz.uicp.io"
console.log(redirect(url))