Tag: array

  • Find a second largest number in array with Javascript

    Back to the simple coding questions. This time with javascript – it seems the easiest language to test with. Code for the problem can be run over here: http://js.do/code/svetliy-second-largest var first_largest; var second_largess; function large(a_list){ if (a_list.length == 0 || a_list.length == 1) return “None”; if (a_list[0] > a_list[1]){ first_largest = a_list[0]; second_largest = a_list[1];…