找出元素中的水落仙花数

118 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>

    function Fn(state,end){
        var temp =[]
        for(var i=state;i<end;i++){
                    // i+''
            var t =i.toString().split('')
            Math.pow(t[0],3)+Math.pow(t[1],3)+Math.pow(t[2],3)===i?temp.push(i):''
        }
        return temp
    }
    
    console.log(Fn(100,9999))
</script>