JSFiddle - React, Tailwind, and code Playground
by Persio
HTML
<p></p>
JavaScript
$(function() {
$(document).live('click', function() {
// объявляем конструктор
function ArrayMaker(arg1, arg2) {
this.someProperty = 'неважно';
this.theArray = [ this, arg1, arg2 ];
}
// объявляем методы
ArrayMaker.prototype = {
someMethod: function () {
alert('Вызван someMethod');
},
getArray: function () {
return this.theArray;
}
};
var am = new ArrayMaker( 'one', 'two' );
var other = new ArrayMaker( 'first', 'second' );
$('p').text(am.getArray()); // => [ am, 'one', 'two' ]
});
});