Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript scale values

function convertRange( value, r1, r2 ) { 
    return ( value - r1[ 0 ] ) * ( r2[ 1 ] - r2[ 0 ] ) / ( r1[ 1 ] - r1[ 0 ] ) + r2[ 0 ];
}

convertRange( 328.17, [ 300.77, 559.22 ], [ 1, 10 ] );

>>> 1.9541497388276272
Comment

PREVIOUS NEXT
Code Example
Javascript :: discord.js find word inside comment 
Javascript :: regex 1-31 days 
Javascript :: nextjs override page route 
Javascript :: hide playback speed from videojs 
Javascript :: regex pattern to validate phone number in jitterbit 
Javascript :: str_limit function filter vuejs 
Javascript :: node js download image from url as buffer 
Javascript :: How to get maximum value in Javascript 
Javascript :: mern heroku Error: ENOENT: no such file or directory 
Javascript :: javascript && operator 
Javascript :: defaultdeep lodash 
Javascript :: nested template strings js 
Javascript :: react icons cdn 
Javascript :: how to setup material-table in react 
Javascript :: remove all white spaces and different characters globally 
Javascript :: https request node.js output incomplete 
Javascript :: identity-obj-proxy not working 
Javascript :: confirm closing tab 
Javascript :: react class component input text with clear button 
Javascript :: back press subscriptions i is not a function react native 
Javascript :: check if alpine js is loaded 
Javascript :: change css file with js 
Javascript :: get two types of date formate datepicker 
Javascript :: how to generate random gradient javascript 
Javascript :: edit json text react 
Javascript :: leaflet js mobile popup not opening 
Javascript :: Open props 
Javascript :: alex morgan 
Javascript :: google maps color pin 
Javascript :: sequelize findall return 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =