-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91a8962
commit aaae98b
Showing
4 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Example</title> | ||
<meta name="description" content="An online JavaScript compiler made by Nitish Khobragade. Write, run, and copy your JavaScript code. The best online tool for JavaScript coding, with features such as syntax highlighting, code completion, and more."> | ||
<meta name="author" content="Nitish Khobragade"> | ||
<meta name="keywords" content="JavaScript, compiler, online, Nitish Khobragade"> | ||
<!-- Add more relevant meta tags as needed --> | ||
|
||
<!-- Google Search Console Verification (replace CONTENT with your verification code) --> | ||
<!-- <meta name="google-site-verification" content="CONTENT"> --> | ||
|
||
<!-- Open Graph Meta Tags (for better sharing on social media) --> | ||
<meta property="og:title" content="FIND LARGEST NUMBER IN ARRAY"> | ||
<meta property="og:description" content="An online JavaScript compiler made by Nitish Khobragade. Write, run, and copy your JavaScript code."> | ||
<!-- Add more Open Graph meta tags as needed --> | ||
<link rel="stylesheet" href="../editor.css" /> | ||
</head> | ||
<body> | ||
<h3 class="question">Prototype-based Inheritance in JavaScript with Constructors using Object.create()</h3> | ||
<div class="btn-container"> | ||
<button id="runBtn">Run</button> | ||
<button id="copyButton">Copy Code</button> | ||
</div> | ||
<div class="editor-container"> | ||
<!-- your code editor starts here --> | ||
<div id="editor"><!--Write Your Code in This div--> | ||
function fruits() { // Defines a constructor function named "fruits" | ||
this.name = 'franco'; // Creates a property "name" and assigns it the value 'franco' within the "fruits" constructor | ||
} | ||
|
||
function fun() { // Defines another constructor function named "fun" | ||
fruits.call(this); // Calls the "fruits" constructor within the context of the current object (this), effectively setting its properties | ||
} | ||
|
||
fun.prototype = Object.create(fruits.prototype); // Creates a new object that inherits from the prototype of "fruits" and sets it as the prototype of "fun" | ||
|
||
const app = new fun(); // Creates a new instance of the "fun" constructor and assigns it to the variable "app" | ||
|
||
console.log(app.name); // Outputs the value of the "name" property of the "app" object, which is 'franco' | ||
|
||
</div> | ||
<!-- your code editor ends here --> | ||
</div> | ||
<div class="result-container"> | ||
<h3>Output:</h3> | ||
<div id="result"></div> | ||
</div> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.7/ace.js"></script> | ||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/tern/0.12.0/tern.js"></script> --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.7/ext-language_tools.js"></script> | ||
<script src="../editor.js"></script> | ||
|
||
|
||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Example</title> | ||
<meta name="description" content="An online JavaScript compiler made by Nitish Khobragade. Write, run, and copy your JavaScript code. The best online tool for JavaScript coding, with features such as syntax highlighting, code completion, and more."> | ||
<meta name="author" content="Nitish Khobragade"> | ||
<meta name="keywords" content="JavaScript, compiler, online, Nitish Khobragade"> | ||
<!-- Add more relevant meta tags as needed --> | ||
|
||
<!-- Google Search Console Verification (replace CONTENT with your verification code) --> | ||
<!-- <meta name="google-site-verification" content="CONTENT"> --> | ||
|
||
<!-- Open Graph Meta Tags (for better sharing on social media) --> | ||
<meta property="og:title" content="FIND LARGEST NUMBER IN ARRAY"> | ||
<meta property="og:description" content="An online JavaScript compiler made by Nitish Khobragade. Write, run, and copy your JavaScript code."> | ||
<!-- Add more Open Graph meta tags as needed --> | ||
<link rel="stylesheet" href="../editor.css" /> | ||
</head> | ||
<body> | ||
<h3 class="question">Prototype-based Inheritance in JavaScript using the 'create' Method</h3> | ||
<div class="btn-container"> | ||
<button id="runBtn">Run</button> | ||
<button id="copyButton">Copy Code</button> | ||
</div> | ||
<div class="editor-container"> | ||
<!-- your code editor starts here --> | ||
<div id="editor"><!--Write Your Code in This div--> | ||
function fruits() { // Defines a constructor function named "fruits" | ||
this.name = 'fruit'; // Creates a property "name" and assigns it the value 'fruit' within the "fruits" constructor | ||
this.season = 'Winter'; // Creates a property "season" and assigns it the value 'Winter' within the "fruits" constructor | ||
} | ||
|
||
function apple() { // Defines another constructor function named "apple" | ||
fruits.call(this); // Calls the "fruits" constructor within the context of the current object (this), effectively setting its properties | ||
} | ||
|
||
apple.prototype = Object.create(fruits.prototype); // Creates a new object that inherits from the prototype of "fruits" and sets it as the prototype of "apple" | ||
|
||
const app = new apple(); // Creates a new instance of the "apple" constructor and assigns it to the variable "app" | ||
|
||
console.log(app.name, app.season); // Outputs the value of the "name" and "season" properties of the "app" object, which are 'fruit' and 'Winter' respectively | ||
console.log(app.season); // Outputs the value of the "season" property of the "app" object again, which is 'Winter' | ||
|
||
</div> | ||
<!-- your code editor ends here --> | ||
</div> | ||
<div class="result-container"> | ||
<h3>Output:</h3> | ||
<div id="result"></div> | ||
</div> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.7/ace.js"></script> | ||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/tern/0.12.0/tern.js"></script> --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.7/ext-language_tools.js"></script> | ||
<script src="../editor.js"></script> | ||
|
||
|
||
</body> | ||
</html> |
This file contains 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