본문 바로가기

Javascript

(7)
Javascript / 자바스크립트 최신 문법 ES6 Shorthand property names const name = 'elie'; const age = '18'; # basic const elie2 = { name : name, age : age, } # Shorthand property names const elie2 = { name, age, } Destructuring assignment //object const student = { name : 'anna', level : 1, } // basic { const name = student.name; const level = student.level; console.log(name, level); // anna 1 } //ES6 - 같은이름을 변수로 { const {name, level} = s..
javascript / 자동 새로고침 refresh 기능 설정 1. 자동으로 해당 페이지가 새로고침 / content 안에는 초단위 ex. 10 (10초) , 300 (5분), 600(10분) 2. 함수 호출시 자동 refresh function 함수명(){ location.reload(); } 3. 함수 호출시 몇 초마다 reload function 함수이명(){ setTimeout('location.reload()',10000); } /10초마다 reload
form 태그 내의 button 역할 form 태그 안에 button이 있으면 무조건 action으로 넘어가기때문에 submit 작용하지 않게 하려면 button 태그 안에 type =button 추가 필수 ✨
javascript / 정수인지 아닌지 확인하는 함수 Number.isInteger(변수명); -> return true / false
javascript /convert to number (숫자로 형 변환) 가장 쉬운 방법 변수명 *= 1; 타입확인 : typeof(변수명)
javascript / 오늘날짜 구하기 let today = new Date(); let year = today.getFullYear(); // 년도 let month = leadingZeros((today.getMonth() + 1),2); // 월 let date = today.getDate(); // 날짜 let now = year+"-"+month+"-"+date; // 월 앞에 0 붙이기 function leadingZeros(n, digits) { var zero = ''; n = n.toString(); if (n.length
Uncaught SyntaxError: Invalid shorthand property initializer Uncaught SyntaxError: Invalid shorthand property initializer ajax 사용시 변수 넣을때 : 를 = 로 사용한 오류 $.ajax({ type: 'post', url: '/shp/rvw', data: { "_token": "{{ csrf_token() }}",shp_id : shp_id, cus_id : cus_id, shp_rtn : shp_rtn, shp_rvw : shp_rvw, ord_no = ord_no},