Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

devolver array con indice de diferencia ejemplos javascript

function mayorMenosMenor(arr) {
    // Obtener del array "arr" el número mayor y el menor. Devuelve la resta entre los mismos
    // NOTA: No utilizar los métodos "min" y "max" de "Math".
    //
    // Tu código:

    var max = arr[0];
    var min = arr[0];
    max = min = arr[0];

    for (var i = 1;i <arr.length; i++) {
	let value = arr[i];
	min = (value < min) ? value : min
	max = (value > max) ? value : max
	var resta =  max - min;
    }
    return resta;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to make a podcast subscribe button in javascript 
Javascript :: on first time this.file.readAsDataURL not working ios 
Javascript :: javascript cuncurrency 
Javascript :: semantic UI react focus on input 
Javascript :: website to word array 
Javascript :: Install React Navigation dependencies into main project folder 
Javascript :: jlkjl 
Javascript :: Create Dynamic Screenshot of any element on a web page - JavaScript 
Javascript :: React native-base DatePicker comes up Minimized on iOS Asked 
Javascript :: tips and tricks for javascript 
Javascript :: show selected text in textarea && activeElement 
Javascript :: check string ifhas character in jquery 
Javascript :: how to make a login form discord.js part 1 
Javascript :: javascript add character to string at position 
Javascript :: how to list out items in js 
Javascript :: 4.3.2. Evaluating Variables¶ 
Javascript :: nodejs hpp github 
Javascript :: clean facebook graphql response 
Javascript :: 7.7. Unicode Table 
Javascript :: scrolling a page using node and puppeteer 
Javascript :: strict scalar types 
Javascript :: deneme 
Javascript :: add margin letf to badge in angular material 
Javascript :: node red using tcp request 
Javascript :: t_networkless_options":true,"disable_signout_supex_users":true,"desktop_adjust_touch_target":true,"kevlar picker ajax 
Javascript :: .chartjs-render-monitor 
Javascript :: array object sort by date 
Javascript :: jqiery bpopup append 
Javascript :: blank array condition in react js 
Javascript :: javascripts 3 months daterange 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =