Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Highest and Lowest

function highAndLow(numbers){
   

    const num = numbers.split(' ')
    let low = +num[0]
    let high = +num[0]
    
    for( let i of num){
        if(+i <low){
            low = +i
        }
        if(+i>high){
            high = +i
        }

        

    }
    return `${high} ${low}`
     

     
  }
Comment

Highest and Lowest

//codewars:Highest and Lowest
function highAndLow(str){

  
let max =-Infinity; 
    let min = Infinity ;
        let x = str.split(" ").map((m)=>{
            m= parseInt(m)
            if(m>max){
                max = m
            }
            if(m<min){
                min = m
            }
        })

        return (`${max} ${min}`)
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: clone canvas 
Javascript :: column to comma separated string in mongodb 
Javascript :: how to change owl nav, how to make custom next-prev button in owl carusol 
Javascript :: HH:mm with am pm jquery 
Javascript :: jquery default value 
Javascript :: install svelte router 
Javascript :: js if the reverse of a number is better than the original num 
Javascript :: bcrypt create encrypted password 
Javascript :: discord.js bot presence 
Javascript :: create functional component react 
Javascript :: fake delay in fetch 
Javascript :: .change() in pure js 
Javascript :: custom ngModel 
Javascript :: competitive programming in javascript 
Javascript :: nodejs express routing get 
Javascript :: chart js react 
Javascript :: remote with post data jquery ajax example 
Javascript :: image name validate using regex javascript 
Javascript :: jquery empecher revoie du formulaire 
Javascript :: remove all white spaces and different characters globally 
Javascript :: getx navigation 
Javascript :: Expo Location get getCurrentPositionAsync not returning anything 
Javascript :: javascript filter array of objects 
Javascript :: jquery deparam 
Javascript :: node js gitignore 
Javascript :: angular autofocus 
Javascript :: Highlight current nav link in react 
Javascript :: javascript decrement 
Javascript :: ja display snippet from text string 
Javascript :: react fetch request with content type x-www-form-urlencoded 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =