JavaScript

JavaScript

npm 보안 취약점 문제 해결

비주얼 스튜디오 코드에서 npm 설치가 되지않는 문제가 발생했다. 찾아보니 보안 종속성 관련 문제로 파악됐다. 이런 경우 npm audit 명령어를 실행하면, 해당 프로젝트에서 사용하는 모든 의존성 패키지들을 검사하여 보안 취약점이 있는 패키지들의 목록을 출력한다. 보안 취약점을 해결할 수 있는 패치 버전으로 의존성 패키지를 업데이트할 수 있다. 터미널 내용에 따르면 의존성 설치 후에 npm이 일부 보안 취약점을 발견했다고 한다. npm audit 를 입력하여 자세한 내용을 알아보았다. nth-check (High Severity): nth-check 패키지의 버전이 2.0.1보다 낮은 경우에는 불필요한 정규 표현식 복잡성이 발생할 수 있습니다. postcss (Moderate Severity): pos..

JavaScript

자바스크립트 기초

자바스크립트란? 웹의 동작을 구현하는 객체 기반 언어 온클립 속성의 값으로 옴. 객체 객체: 이름(name)과 값(value)으로 구성된 프로퍼티의 정렬되지 않은 집합 객체의 프로퍼티 참조 객체이름.프로퍼티이름 또는 객체이름["프로퍼티이름"] 객체의 메소드 참조 객체이름.메소드이름() innerHTML 프로퍼티 선택 1. HTML 태그 이름 - getElementsByTagName() 2. 아이디(id)를 이용한 선택 - getElementById() 3. 클래스(class) - getElementsByClassName() 메 4. name 속성(attribute) - getElementByName() 5. CSS 선택자(아이디, 클래스, 속성, 속성값 등) - querySelectorAll() 6. H..

JavaScript

생활코딩 JavaScript 객체지향 프로그래밍 (4)

객체 간의 상속 var superObj = {superVal: 'super'}; var subObj = {subVal: 'sub'}; subObj.__proto__ = superObj; console.log('subObj.subVal =>', subObj.subVal); console.log('subObj.superVal =>', subObj.superVal); //.__proto__ : subObj의 부모를 superObj로! // 찾았는데 없다면, 부모에서 가져다 씀. subObj.superVal = 'sub'; console.log('superObj.superVal =>', superObj.superVal); // 자식 객체값을 바꿔도, 프로토 값은 바뀌지 않음. (얕은 복사같은 느낌!) // .b..

JavaScript

생활코딩 JavaScript 객체지향 프로그래밍 (3)

class //class 생성 /* class Person { } var kim = new Person(); console.log(kim); */ // class constructor function class Person { constructor(name, first, second){ this.name = name; this.first = first; this.second = second; } } var kim = new Person('kim', 10, 20); console.log('kim', kim); // 출력값: kim Person { name: 'kim', first: 10, second: 20 } class constructor class Person { constructor(name, fi..

JavaScript

생활코딩 JavaScript 객체지향 프로그래밍 (2)

객체 실제로 사용하기 console.log("Math.PI", Math.PI); console.log("Math.random()", Math.random()); console.log("Math.floor(3.9)", Math.floor(3.9)); // 객체에 소속된 함수 = 메소드 var MyMath = { PI: Math.PI, random: function(){ return Math.random(); }, floor: function(val) { return Math.floor(val); } } console.log(MyMath.PI); console.log(MyMath.random()); console.log(MyMath.floor(3.9)); "this" 란? 메소드 내에서 메소드가 속한 객체를..

abyss-s
'JavaScript' 카테고리의 글 목록