Backend 01

Run Settings
LanguageJavaScript
Language Version
Run Command
/* ************************************ * 64160280 * Phachara Aunkitti : Authors *************************************/ function exam01(alice, bob) { // Declare varibles let aliceCount = 0; //for count alice points let bobCount = 0; // for count bob points // loop for comparing value between alice and bob for (let round = 0; round < alice.length; round++) { if (alice[round] > bob[round]) { // condition to check if alice point more than bob point aliceCount++; } else if (alice[round] < bob[round]) { // condition to check if bob point more than point point bobCount++; } } // return aliceCount, bobCount are points of alice and bob. return [aliceCount, bobCount]; } function test_01() { if (JSON.stringify(exam01([1, 2, 3], [7, 1, 3])) === JSON.stringify([1, 1])) { console.log("pass"); } else { console.log("fail"); } } test_01();
Editor Settings
Theme
Key bindings
Full width
Lines