Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Tow sums

function twoSum(numbers, target) {
  for (i = 0; i < numbers.length; i++) {
    second = numbers.indexOf(target - numbers[i], i+1);
    if (second > i) {
      return [i, second];
    }
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: parse and stringify dom element in js 
Javascript :: _.has Creator Functions Do Not Have "Constructor" 
Javascript :: Return A "Constructor" Function 
Javascript :: odoo js reload widget 
Javascript :: createTextRange code example 
Javascript :: scroll to bottom of page javascript 
Javascript :: finding the smallest number other than 0 in an array javascript 
Javascript :: GridFs Schema 
Javascript :: JSON: remember you can use a value that comes later 
Javascript :: sum properties some objects when merge their 
Javascript :: js template literal avoid white spaces 
Javascript :: invalid json text mysql 
Javascript :: onPlay 
Javascript :: how to cut and paste an element in vanilla javascript 
Javascript :: how to filter through an array of objects 
Javascript :: telerik mvc grid add row 
Javascript :: eva icons js 
Javascript :: port for sqlexpress not found in desktop node.js 
Javascript :: routing with django and react 
Javascript :: react component lifecycle 
Javascript :: use prism to render markdown in next js with gray-matter 
Javascript :: events in node js 
Javascript :: pencil button in react 
Javascript :: how to get mongoose connection status 
Javascript :: findOneAndUpdate many fields 
Javascript :: Why is node creating multiple server in cpanel 
Javascript :: copy multi cell value from one sheet to another using google app script 
Javascript :: function solution(n) { } 
Javascript :: Fetch data changing on reload from array to undefined 
Javascript :: angularjs Why does using .match inside of an ng-if seem to cause digest cycles 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =