Skip to content

Instantly share code, notes, and snippets.

function Rectangle( x, y, width, height, options ){
this.getCenter = function(){
return {
x: x + width/2,
y: y + height/2
};
}
function Rectangle( x, y, width, height, options ){
this.getCenter = function(){
return {
x: x + width/2,
y: y + height/2
};
}
function Rectangle( x, y, width, height, options ){
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.color = options.color;
this.text = options.text;
this.getCenter = function(){
function Rectangle( x, y, width, height, options){
//…
};
//использование
var rectangle = new Rectangle( 10, 10, 100, 150, { color:’red’,
//…
text: ‘Hello!} );
function Rectangle( options ){
//…
}
var rectangle = new Rectangle({
x : 10,
y : 10,
width : 100,
height: 150,
var x = 10,
y = 10,
height = 100,
width = 150,
color = ‘red’;
var rectangle = new Rectangle( x, y, height, width, color );
@Zlob
Zlob / params_separated.js
Last active February 3, 2016 14:00
Article examples
function Rectangle( x, y, width, height, color ){
//…
};
//использование
var rectangle = new Rectangle( 10, 10, 100, 150, ‘red’ );