Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

first duplicate javascript

function firstDuplicate(a) {
    let data = [];
    
    for (dup of a) {
        if (data[dup]) {
            return dup
        } else {
            data[dup] = dup
        }
    }
    return -1
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: webpack set mode to development 
Javascript :: nuxt js if is client 
Javascript :: req.url 
Javascript :: roblox headshot image js 
Javascript :: javascript replace doublequote with empty string 
Javascript :: How to install react native hooks with npm 
Javascript :: input length material Ui Design 
Javascript :: html string to object jquery 
Javascript :: sum numbers recursively js 
Javascript :: javascript rtsp player 
Javascript :: js transitions 
Javascript :: swapping elements in an array 
Javascript :: test if property exists javascript 
Javascript :: apk react native 
Javascript :: merge data to json js 
Javascript :: zero timeout javascript 
Javascript :: how to detect which key is pressed in javascript 
Javascript :: javascript replace all 
Javascript :: jquery remove option from dropdown 
Javascript :: download canvas js 
Javascript :: smooth scroll to target with offset 
Javascript :: regex match everything except 
Javascript :: what is data node in big data 
Javascript :: filter biggest value javascript object 
Javascript :: jquery set html of element 
Javascript :: nodejs wait event loop to finish 
Javascript :: get last element in array in js 
Javascript :: react state hooks 
Javascript :: new File in js 
Javascript :: contenteditable javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =