본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

JavaScript (16)
Window event

child to parent window.opener(): 새 창을 만든 window를 reference window.postMessage(): window간의 cross-origin 통신을 가능하게 함. 메시지를 받을 때는, 윈도우의 ‘message’ 이벤트에 대한 핸들러를 등록하면 된다. window.opener.postMessage({ event: "DIALOG_OPEN" }, _url); window.addEventListener("message", (event) => { switch ((event.data || {}).event) { case "READING_ON": { this.readingOn(); break; } case "READING_OFF" : { this.readingOff(even..

JavaScript 2022. 10. 7. 08:39
window in Javascript

window in Javascript - 어디서든 접근이 가능한 전역객체 - browser window를 의미하고, browser window를 control 할 수있는 다양한 method 제공 - 내가 작성하는 코드들이 이 window object의 property가 된다. 그래서 특별한 경우를 제외하고는 window는 생략이 가능하다. 단, const와 let은 scope가 object내에 속하기에 global object property로는 사용할 수 없다. - window.close() window.open() window.innerHeight window.innerWidth 등을 사용해서 window창 제어가능. // 1. 단축키를 사용 handle close function 호출 functio..

JavaScript 2022. 10. 6. 10:05
code refactoring 01

original code. setPeople function 은 multiple rows의 선택과는 관계없이 선택된 row가 single row인지만 확인한다. 1. 리덕스에서 받아온 selectedRows의 element 들을 굳이 각자 따로 받아와서 variable을 만들 필요가 없다. 2. array를 map 으로 loop 해서 받아온 것을 다시 assign하는 과정에서 다시 array 로 assign 하는 과정을 불필요하게 거침. function setPeople(result: any) { setDropdownList(result.map((people:any) => ({ label : `${people.name}(${people.email})`, value : people.id }))); cons..

JavaScript 2022. 10. 5. 10:43
short circuit evaluation

1. This single line of short circuit evaluation is let value = options && options.value || ''; equal to this code let value; if(options){ value = options.value; } else value = ''; 2. stick > min && target.push(stick - min); if(stick > min){ target.push(stick - min); }

JavaScript 2020. 12. 26. 23:51
Spread Operator

Spread Operator in Javascript 1. In ES6, By using the spread operator, you can simply populate an array to another array. '=' only allows you to copy the reference not the value of the array. '=' 는 단지 주소값을 전달할 뿐 진짜 값을 전달하지 못하기때문에 spread operator를 사용해서 array를 복사할 수 있다. function threeDots(arr) { let sticks = [...arr]; } 2. Math.min() and Math.max() expect a list of arguments not an array. If you w..

JavaScript 2020. 12. 26. 22:03
Type Conversion in Javascript (number, string)

Javascript는 type을 쓰지 않으니 원치않는 결과를 가질 때가 있는데 이럴때 아주 간단하게 형변환을 하는 방법이 있다. number + string type "" 은 number to string type conversion string * 1 은 string to number conversion Example code let arr = [1, 2, 3]; console.log(typeof arr); //datatype: object console.log(typeof arr[1]); //datatype: number let changeToString = (arr + "").split(","); //number + "": changed to string console.log(changeToStri..

JavaScript 2020. 9. 15. 16:47
이전 1 2 3 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • easy algorithm
  • hackerrank javascript solution
  • hackerrank javascript
  • javascript
  • java
  • 프로그래머스 알고리즘
  • algorithm
  • easy javascript algorithm
  • Collection Framework
  • spring boot application
  • HackerRank Algorithm
  • 프로그래머스 알고리즘문제
  • 프로그래머스
  • substring()
  • math.max
  • rest parameter
  • compareTo()
  • Javascript Algorithm
  • hackerrank
  • ... in Javascript
  • HashMap
  • 알고리즘
  • C++
  • string class in java
  • code refactoring
  • Object type casting
  • hackerrank solution
  • equals()
  • math.abs
  • repeat()
more
«   2025/08   »
일 월 화 수 목 금 토
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바