This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Rectangle( x, y, width, height, options ){ | |
| this.getCenter = function(){ | |
| return { | |
| x: x + width/2, | |
| y: y + height/2 | |
| }; | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Rectangle( x, y, width, height, options ){ | |
| this.getCenter = function(){ | |
| return { | |
| x: x + width/2, | |
| y: y + height/2 | |
| }; | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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(){ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Rectangle( x, y, width, height, options){ | |
| //… | |
| }; | |
| //использование | |
| var rectangle = new Rectangle( 10, 10, 100, 150, { color:’red’, | |
| //… | |
| text: ‘Hello!’} ); | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Rectangle( options ){ | |
| //… | |
| } | |
| var rectangle = new Rectangle({ | |
| x : 10, | |
| y : 10, | |
| width : 100, | |
| height: 150, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var x = 10, | |
| y = 10, | |
| height = 100, | |
| width = 150, | |
| color = ‘red’; | |
| var rectangle = new Rectangle( x, y, height, width, color ); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Rectangle( x, y, width, height, color ){ | |
| //… | |
| }; | |
| //использование | |
| var rectangle = new Rectangle( 10, 10, 100, 150, ‘red’ ); | 
NewerOlder