ES6-Spread operator >spread oprator? 펼침 연산자라 생각하면 된다. //spread operator, 펼침 연산자. let pre = ["apple", "orange",100]; let newData = [...pre]; console.log(pre === newData); ->false >spread oprator의 활용 //spread operator, 펼침 연산자. let pre = [100,200,"hello",null]; let newData = [0,1,2,3,...pre,4];예전같으면 배열의 인덱스 확인하고, 자르고, 넣고하는 과정들이 있었을 것이다.이를생각하면 정말 간편해진 것이다.!! function sum(a,b,c) { return a+b+c; }..
Ruby on rails-세션과 쿠키(로그인 기능) >http 프로토콜의 문제점 (멋사 운영진 강의 참고) 요청간의 관계가 없다!stateless protocol (요청을 받으면 서버에서 응답을 보내고 거기서 끝)로그인과 장바구니와 같은 기능은 문제가 있다.>SESSION 과 COOKIE세션일정시간(브라우저 종료시 까지) 반 영구적으로 상태를 유지(서버)ex) 로그인, 장바구니쿠키사용자의 브라우저에 저장되는 텍스트 정보(클라이언트),쿠키를 통해 세션을 구현 >SESSION 을 만들어보자.rails g controller Sessions new create destroy->sessions 컨트롤러 생성Resources :sessions, only [:new, :create, :destroy]
ES6-for of 순회하기 >es6 에 새로 나온 배열을 순회하는 for of에 대하여 알아보자. //1.foreach var data = [1,2,undefined,NaN,null,""] //foreach로도 순회하여 값을 알 수 있음. data.forEach(function(value){ console.log(value); }) //2.for in //for in은 문제점이 자기자신이 갖고있지 않은 상위에 있는 추가된 값 까지도 표현하여 나타남 for(let idx in data){ console.log(data[idx]) } //로 찍어 주면 function(){}도 콘솔에 찍힘. ->잘못됨 ex) Array.prototype.getIndex =function(){}; 라고 추가해주면, for(l..
Ruby on rails -tiny mce 새로고침해야 에디터창이 뜰때 해결방법 https://stackoverflow.com/questions/26962995/tinymce-only-loads-on-page-refresh를 참고하기 바란다. 1.gem “turbolinks 를 삭제2.bundle 명령어 입력3.//= require turbolinks를 application.js파일에서 제거해준다.4.data-turbolinks-track 이라는 키워드가 들어간 줄을 application.html 에서 제거해준다.
ES2015 string에 새로운 메서드들 //hello로 시작하는지를 어떻게 확인 할까? let str = "hello world ! ^^~~"; let matchstr = "hello"; let matchstr = "~~"; //1.시작하는 문자열 검사 console.log(str.startsWith(matchstr)); //2.끝나는 문자열 검사 console.log(str.endsWith(matchstr)); //3.문자열 포함여부 검사 console.log(str.includes("world")); ->모든 결과값: truehttp://takeuu.tistory.com/102 에 들어가보면, es6에 새로 추가된 배열관련 메서드들이나, 기존의 스트링,배열관련 메서드들을 확인할 수 있다.