function square(arr) {
    // 简洁即是优雅
    return arr.map(x => x*x)
    // 还可以这样↓(只不过牛客网的JS版本低,不支持这种语法)
    // return arr.map(x => x**2)
}