keycode = { getKeyCode : function(e) { var keycode = null; if(window.event) { keycode = window.event.keyCode; }else if(e) { keycode = e.which; } return keycode; }, getKeyCodeValue : function(keyCode, shiftKey) { shiftKey = shiftKey || false; var value = null; if(shiftKey === true) { value = this.modifiedByShift[keyCode]; }else { value = this.keyCodeMap[keyCode]; } return value; }, getValueByEven..
constructor 속성은 객체를 만드는 기능함수를 반환하거나, 설정을 하는 메소드 이다. 생성된 객체의 constructor 속성을 통해 해당 생성자 함수와 일치 여부가 가능하다 function A() { this.name = "A함수"; this.getName = function() { return this.name; } } a = new A(); document.writeln(a.constructor); //function A() { this.name = "A\uD568\uC218"; this.getName = function () {return this.name;}; } document.writeln(a.constructor == A); //결과 : true function A() { this...
/** * 트위터 bootstrap js 패턴 */ ;(function($){ var Calculator = function( el, options ) { this.$el = $(el); this.options = $.extend({} , $.fn.calculator.defaults, options); } Calculator.prototype = { constructor : Calculator , show : function(){ console.log( this.options ); } } $.fn.calculator = function ( option ) { return this.each(function(){ var $this = $(this) , data = $this.data('calculator')..