확인
![[JS] 접속한 브라우저 체크하기](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbCEF6t%2Fbtsd0vzHM0l%2FxBfzRnt5bMk354cPuXim51%2Fimg.png)
[JS] 접속한 브라우저 체크하기
예시코드 See the Pen Untitled by hyukson (@hyukson) on CodePen. 전체 코드 function getBrowser() { const browsers = [ 'Chrome', 'Opera', 'WebTV', 'Whale', 'Beonex', 'Chimera', 'NetPositive', 'Phoenix', 'Firefox', 'Safari', 'SkipStone', 'Netscape', 'Mozilla', ]; const userAgent = window.navigator.userAgent.toLowerCase(); if (userAgent.includes("edg")) { return "Edge"; } if (userAgent.includes("trident") |..
[JS] 객체에 특정 KEY값이 존재하는지 확인하기
includes() 사용 const obj = {a: false, b: true, c: null}; Object.keys(obj).includes('a'); // true Object.keys(obj).includes('abc'); // false Object.keys() 메서드로 객체의 모든 키값을 담은 배열을 생성해 주고, includes() 메서드로 해당 키가 존재하는지 판별해 줍니다. in 연산자 사용 const obj = {a: false, b: true, c: null}; 'c' in obj // true 'abc' in obj // false in 연산자를 사용하면 간단한 코드로 key가 존재하는지 간단하게 확인할 수 있습니다. obj.prototype.test = false; 'test' ..