Skip to main content
deleted 2 characters in body
Source Link
user82328
user82328

JavaScript (Node.js), 48 bytes

a=>a.filter(b=>eval([...b+""].join`+`)**.5%1==0)

Try it online!

Explanation

a =>                                  // lambda function taking one argument
    a.filter(                         // filter the list
        eval(                         // begin eval
            [...b+""]                 // convert number to array of digits 
                .join`+`              // join them with + sign
            )                         // close eval. we achieved sum of all elementsdigits of digitsnumber
        **.5                          // square root of number
        %1==0                         // check for perfect square
    )                                 // end filter and return value

JavaScript (Node.js), 48 bytes

a=>a.filter(b=>eval([...b+""].join`+`)**.5%1==0)

Try it online!

Explanation

a =>                                  // lambda function taking one argument
    a.filter(                         // filter the list
        eval(                         // begin eval
            [...b+""]                 // convert number to array of digits 
                .join`+`              // join them with + sign
            )                         // close eval. we achieved sum of all elements of digits
        **.5                          // square root of number
        %1==0                         // check for perfect square
    )                                 // end filter and return value

JavaScript (Node.js), 48 bytes

a=>a.filter(b=>eval([...b+""].join`+`)**.5%1==0)

Try it online!

Explanation

a =>                                  // lambda function taking one argument
    a.filter(                         // filter the list
        eval(                         // begin eval
            [...b+""]                 // convert number to array of digits 
                .join`+`              // join them with + sign
            )                         // close eval. we achieved sum of all digits of number
        **.5                          // square root of number
        %1==0                         // check for perfect square
    )                                 // end filter and return value
Source Link
user82328
user82328

JavaScript (Node.js), 48 bytes

a=>a.filter(b=>eval([...b+""].join`+`)**.5%1==0)

Try it online!

Explanation

a =>                                  // lambda function taking one argument
    a.filter(                         // filter the list
        eval(                         // begin eval
            [...b+""]                 // convert number to array of digits 
                .join`+`              // join them with + sign
            )                         // close eval. we achieved sum of all elements of digits
        **.5                          // square root of number
        %1==0                         // check for perfect square
    )                                 // end filter and return value