Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
Created July 12, 2016 09:08
Show Gist options
  • Select an option

  • Save dstyle0210/84e91b1bf5230ddf691cbe88ca465dbd to your computer and use it in GitHub Desktop.

Select an option

Save dstyle0210/84e91b1bf5230ddf691cbe88ca465dbd to your computer and use it in GitHub Desktop.
[코딩도장] 게시판 페이징
// 코딩도장 공부
// http://codingdojang.com/scode/406
var m = Math.floor(Math.random()*100); // 총건수
var n = Math.floor(Math.random()*10)+1; // 한페이지에 보여줄 게시물수 (n은 1보다 크거나 같다)
var paging = (0<m) ? Math.floor(m/n) : 0; // 총건수가 0개면, 리턴도 0개.
paging = (paging!=0 && m%n!=0) ? paging + 1 : paging;
console.log(m+","+n+","+paging);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment