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
| // Listen for submit | |
| document.getElementById('loan-form').addEventListener('submit', function (e) { | |
| // Hide results | |
| document.getElementById('results').style.display = 'none'; | |
| // Show loader | |
| document.getElementById('loading').style.display = 'block'; | |
| setTimeout(calculateResults, 2000); | |
| e.preventDefault(); |
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
| class EvenNum: | |
| def __init__(self, size) -> None: | |
| self.size = size | |
| print(self, end=" : ") | |
| def __iter__(self): | |
| self.count = 0 | |
| return self | |
| def __next__(self): |
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
| # sand box 1 file ------------------------------------------------------------------- | |
| import SandBox2 | |
| if __name__ == "__main__": | |
| print("Executed when invoked directly from SANDBOX 1") | |
| else: | |
| print("Executed when imported from SANDBOX 1") | |
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
| /* | |
| GAME FUNCTION: | |
| - Player must guess a number between a min and max | |
| - Player gets a certain amount of guesses | |
| - Notify player of guesses remaining | |
| - Notify the player of the correct answer if loose | |
| - Let player choose to play again | |
| */ | |
| // Game values |
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
| // Object prototype | |
| // | | |
| // Person prototype | |
| // | | |
| // Person instance ex) john | |
| // Constructor | |
| function Person(firstName, lastName, dob) { | |
| this.firstName = firstName; | |
| this.lastName = lastName; |
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 Person(firstName, lastName) { | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| } | |
| Person.prototype.greeting = function () { | |
| return `Hello there ${this.firstName} ${this.lastName}`; | |
| }; | |
| const person1 = new Person('John', 'Doe'); |
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
| // Book Constructor | |
| function Book(title, author, isbn) { | |
| this.title = title; | |
| this.author = author; | |
| this.isbn = this.isbn; | |
| } | |
| // UI Constructor | |
| function UI() {} | |
| UI.prototype.addBookToList = function (book) { |
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
| // XHR (xmlHTTPrequest) - JSON --------------------------------------------------------------------- | |
| document.getElementById('button2').addEventListener('click', loadCustomers); | |
| function loadCustomers(e) { | |
| const xhr = new XMLHttpRequest(); | |
| xhr.open('GET', 'customers.json', true); | |
| xhr.onload = function () { | |
| if (this.status === 200) { |
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 easyHTTP() { | |
| this.http = new XMLHttpRequest(); | |
| } | |
| // Make an HTTP GET Request | |
| easyHTTP.prototype.get = function (url, callback) { | |
| this.http.open('GET', url, true); | |
| let self = this; | |
| this.http.onload = 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
| const posts = [ | |
| { title: 'Post one', body: 'this is post one' }, | |
| { title: 'Post two', body: 'this is post two' } | |
| ]; | |
| function createPost(post) { | |
| return new Promise(function (resolve, reject) { | |
| setTimeout(function () { | |
| posts.push(post); | |
| const error = false; |