mirror of
				https://github.com/flynx/Course-JavaScript.git
				synced 2025-10-31 12:00:08 +00:00 
			
		
		
		
	some cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									1393c03f5b
								
							
						
					
					
						commit
						c3d57ce9a8
					
				
							
								
								
									
										15
									
								
								js-oop.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								js-oop.js
									
									
									
									
									
								
							| @ -375,13 +375,14 @@ | |||||||
| // equivalent to instanceof:
 | // equivalent to instanceof:
 | ||||||
| 	 | 	 | ||||||
| 	function isInstanceOf(obj, proto){ | 	function isInstanceOf(obj, proto){ | ||||||
| 		return proto instanceof Function  | 		return obj === Function && proto === Function ? true  | ||||||
| 			&& (obj.__proto__ === proto.prototype ? true | 			: (isInstanceOf(proto, Function) | ||||||
| 				// NOTE: the last in this chain is Object.prototype.__proto__ 
 | 				&& (obj.__proto__ === proto.prototype ? true | ||||||
| 				// 		and it is null
 | 					// NOTE: the last in this chain is Object.prototype.__proto__ 
 | ||||||
| 				: obj.__proto__ == null ? false | 					// 		and it is null
 | ||||||
| 				// go down the chain...
 | 					: obj.__proto__ == null ? false | ||||||
| 				: isInstanceOf(obj.__proto__, proto)) | 					// go down the chain...
 | ||||||
|  | 					: isInstanceOf(obj.__proto__, proto))) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	isInstanceOf(c, C)	// -> true
 | 	isInstanceOf(c, C)	// -> true
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user