Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Sort number in descending order

function solution(n) {
    return parseInt(n.toString().split('').sort((val1,val2) => val2-val1).join(''));
}

Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery if .val is blank 
Javascript :: get full month from date javascript 
Javascript :: react native slow performance after load iamges 
Javascript :: get index of item array 
Javascript :: how to validate the textbox using jquery 
Javascript :: vue js countdown timer 
Javascript :: javascript date is an object 
Javascript :: loop through array backwards 
Javascript :: react-native android build apk 
Javascript :: javascript reverse loop 
Javascript :: change no to string in js 
Javascript :: convert decimal to binary javascript 
Javascript :: angular access service in console 
Javascript :: check if input has value javascript 
Javascript :: viewchild for ngfor 
Javascript :: onchange js 
Javascript :: getting state in react-router-dom v6 
Javascript :: check if string contains at least one number javascript 
Javascript :: what 1hr in milliseconds in javascript 
Javascript :: loop in object javascript 
Javascript :: how to close tab by javascript 
Javascript :: MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string. 
Javascript :: snentence case capitalisation js 
Javascript :: javascript get value 
Javascript :: js new date short format 
Javascript :: create array javascript 
Javascript :: three js render 
Javascript :: javascript for...in with Arrays 
Javascript :: server status minecraft javascript 
Javascript :: javascript array of zeros 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =