“JavaScript Runtime Calculator” Kode Jawaban

Waktu hitungan JavaScript

var start = new Date().getTime();

for (i = 0; i < 50000; ++i) {
// do something
}

var end = new Date().getTime();
var time = end - start;
alert('Execution time: ' + time);
Helpful Hyena

JavaScript Runtime Calculator

function isSum(numbers, targt){
    var storage = [];
    for(var i = 0; i < numbers.length; i++){
        var currentNum = numbers[i];
        var NumberNeeded = targt - currentNum;
        var index2 = storage[NumberNeeded];
        if(index2 != undefined){
            return [index2, i];
        }else{
            storage[numbers[i]] = i; 
        }
    }
    return -1;
}

var arr = [76, 70, 65, 15, 66, 16, 10, 11, 86, 57, 86, 88, 21, 62, 85, 12, 90, 41, 84, 18, 57, 60, 78, 99, 59, 43, 32, 35, 7, 41, 96, 7, 22, 3, 97, 54, 43, 95, 2, 4, 29, 10, 76, 82, 88, 36, 16, 55, 22, 20, 83, 10, 82, 45, 74, 52, 54, 33, 50, 13, 100, 90, 72, 49, 92, 70, 16, 15, 10, 56, 0, 60, 2, 36, 6, 74, 34, 12, 83, 1, 76, 18, 45, 40, 61, 18, 65, 17, 53, 32, 35, 27, 12, 39, 46, 33, 68, 94, 62, 88, 15, 75, 78, 62, 75, 38, 41, 1, 2, 90, 92, 74, 27, 48, 9, 56, 50, 57, 6, 39, 47, 2, 59, 4, 83, 18, 13, 57, 92, 9, 85, 14, 9, 48, 11, 26, 7, 60, 57, 22, 26, 77, 34, 28, 42, 17, 82, 58, 35, 56, 76, 74, 71, 83, 6, 69, 92, 4, 50, 70, 30, 72, 6, 46, 78, 84, 77, 17, 78, 56, 17, 46, 43, 9, 38, 9, 73, 10, 20, 30, 11, 37, 33, 81, 86, 89, 16, 13, 71, 18, 0, 57, 65, 83, 72, 71, 84, 30, 69, 36, 17, 53, 43, 63, 100, 75, 80, 21, 90, 63, 64, 40, 15, 14, 83, 96, 42, 87, 37, 52, 36, 94, 83, 77, 15, 17, 68, 39, 79, 30, 41, 88, 59, 12, 57, 70, 39, 0, 7, 45, 38, 31, 43, 7, 22, 18, 45, 80, 3, 95];
var number = 200;
Drab Dolphin

Jawaban yang mirip dengan “JavaScript Runtime Calculator”

Pertanyaan yang mirip dengan “JavaScript Runtime Calculator”

Lebih banyak jawaban terkait untuk “JavaScript Runtime Calculator” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya