Create a component definition, which will be loaded in both the parent and child windows.
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 DEFAULT_TOTAL = 10; | |
| var total = 5; | |
| function getTotal() { | |
| "use strict"; | |
| if (!total) { | |
| var total = DEFAULT_TOTAL; | |
| } |
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 foo() { | |
| "use strict"; | |
| console.log(x); | |
| var x = 1; | |
| } | |
| use-before-define.js | |
| #1 'x' was used before it was defined. |
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 DEFAULT_TOTAL = 10; | |
| var total = 5; | |
| function getTotal() { | |
| "use strict"; | |
| if (!total) { | |
| var total = DEFAULT_TOTAL; | |
| } |
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 DEFAULT_TOTAL = 10; | |
| var total = 5; | |
| function getTotal() { | |
| "use strict"; | |
| if (!total) { | |
| var total = DEFAULT_TOTAL; | |
| } |
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
| <script src="https://www.paypalobjects.com/api/checkout.js"></script> | |
| <div class="container"> | |
| <p>Choose your method of payment: </p> | |
| <form> | |
| <div class="radio resize"> | |
| <label> | |
| <input type="radio" name="paymentOption" value="paypal" checked> | |
| <img src="../img/payWithPaypal.jpg" alt="Pay with Paypal" class="paymentOptions" width="55" height="40"> | |
| </label> |
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 serialAsyncMap = function () { | |
| var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(collection, fn) { | |
| var result, _iterator, _isArray, _i, _ref2, item; | |
| return regeneratorRuntime.wrap(function _callee$(_context) { | |
| while (1) { | |
| switch (_context.prev = _context.next) { | |
| case 0: | |
| result = []; | |
| _iterator = collection, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); |
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
| async function makePizza(sauceType = 'red') { | |
| let dough = makeDough(); | |
| let sauce = makeSauce(sauceType); | |
| let cheese = grateCheese((await sauce).determineCheese()); | |
| (await dough).add(await sauce); | |
| (await dough).add(await cheese); | |
| return await dough; |
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
| // Create a 'once' function that generates a new function which can only be called once | |
| function sayHello() { | |
| console.log('hello'); | |
| } | |
| var sayHelloOnce = once(sayHello); | |
| sayHelloOnce(); // logs 'hello' | |
| sayHelloOnce(); // does nothing |
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
| // Create a 'sayTo' function that lets you "say something to someone" like so: | |
| let sayToJill = sayTo('Jill'); | |
| sayToJill.say('hello'); // logs 'hello Jill!' | |
| sayToJill.say('goodbye'); // logs 'goodbye Jill!' |