This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| navigator.mediaDevices.enumerateDevices() will return an empty label attribute value | |
| if the permission for accessing the mediadevice is not given. | |
| Try using it after getUserMedia. | |
| **/ | |
| (async () => { | |
| await navigator.mediaDevices.getUserMedia({audio: true, video: true}); | |
| let devices = await navigator.mediaDevices.enumerateDevices(); | |
| console.log(devices); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Shorthend property names | |
| //변수명과 키값이 같은 경우 생략이 가능하다. | |
| const name = 'Sori'; | |
| const age = '32'; | |
| const sori = { | |
| name: name, | |
| age: age | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let constraints = {video: true}; | |
| (async () => { | |
| try{ | |
| await navigator.mediaDevices.getUserMedia(constraints).then(function (param, streams) { | |
| throw error | |
| if (getLocalStream) { | |
| /*mediaDevices체크 */ | |
| let videoTracks = streams.getVideoTracks(); | |
| let audioTracks = streams.getAudioTracks(); | |
| console.log('dev test selected camera : ' + videoTracks[0].label); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 에러이유 : 관리자가 아닌 ms 계정으로 로그인한 윈도우10에서 Visual Studio Code 에서 Vue 개발환경을 설정하던 중 보안 오류가 발생함. | |
| 해결방법 : | |
| d:\sori> Get-ExecutionPolicy -Scope CurrentUser | |
| d:\sori> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser | |
| d:\sori> Get-ExecutionPolicy -List | |
| 관련문서 | |
| https://docs.microsoft.com/ko-kr/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //nullidh coalescing operator ?? is only case null, undefined check.' | |
| //do not confusing to Logical OR operator || is only case false(0, undefined, null, "",'',``) or true check. | |
| //bad code | |
| function printMessage(test){ | |
| let message = text; | |
| if(text == null || text == undefined) { | |
| message = 'Nothing to display'; | |
| } | |
| console.log(message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //bad code | |
| function getResult(score) { | |
| let result; | |
| if(score > 5) { | |
| result = 'up'; | |
| } else if (score <= 5) { | |
| result = 'down'; | |
| } | |
| return result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Object Destructuring | |
| const person = { | |
| name = 'Julia', | |
| age = 20, | |
| phone: '0102222222' | |
| }; | |
| //bad code | |
| function displayPerson(person){ | |
| displayAvatar(person.name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Spread Syntax - Object | |
| const item = { type: 'shirts', size : 'M' }; | |
| const detail = { price: 20, made: 'Kores', gender: 'M' }; | |
| //bad code | |
| item['price'] = detail.price; | |
| //bad code | |
| const newObject = new Object; | |
| newObject['type'] = itme.type; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bob = { | |
| name: 'Julia', | |
| age: 20, | |
| }; | |
| const anna = { | |
| name: 'Julia', | |
| age: 20, | |
| job: { | |
| title: 'Software Engineer' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Template Literals (Template String) | |
| const person = { | |
| name: 'Julia', | |
| score: 4, | |
| }; | |
| //bad code | |
| console.log( | |
| 'Hello ' + person.name + ', Your current score is: ' + person.score | |
| ); |