Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

square root numbers in array javascript

function squareOrSquareRoot(array) {
  return array.map(x => {
    const r = Math.sqrt(x);
    return (r % 1 == 0) ? r : (x*x);
  });  
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: append child at the top 
Javascript :: chrome.storage.local.remove example 
Javascript :: check if string contains lowercase javascript 
Javascript :: redux devtools extension 
Javascript :: Regular Expression for Detect Iranian Mobile Phone Numbers | IR mobile number Regex Pattern 
Javascript :: React JS CDN Links 
Javascript :: javascript download current html page 
Javascript :: js math.trunc 
Javascript :: return symmetric difference of the array javascript 
Javascript :: discord js clear message from id 
Javascript :: javascript ternary 
Javascript :: react index.jsx example 
Javascript :: javascript change css 
Javascript :: ignore eslint warning one line 
Javascript :: get format file in javascript 
Javascript :: flatten an array without using .flat(); 
Javascript :: iterate object 
Javascript :: how to drop collection in mongoose 
Javascript :: getting average of array javascript 
Javascript :: express js npm 
Javascript :: react fragment 
Javascript :: get all the child of the same class javascript 
Javascript :: clear html element javascript 
Javascript :: how to contain image size 
Javascript :: how to erase spaces from a string javascript 
Javascript :: javascript regex cheat sheet 
Javascript :: MongoParseError: options buffermaxentries, usefindandmodify, usecreateindex are not supported 
Javascript :: inheritance in es6 
Javascript :: vuejs props 
Javascript :: express middleware logging 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =