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 makeIterator(){ | |
| var nextIndex = 0; | |
| return { | |
| next: function(){ | |
| return nextIndex < 5 ? { value: nextIndex++, done: false} : {done: true} | |
| } | |
| } | |
| } | |
| var it = makeIterator(); |
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 sayings = new Map(); | |
| sayings.set("dog", "woof"); | |
| sayings.set("cat", "meow"); | |
| sayings.set("elephant", "toot"); | |
| sayings.size; // 3 | |
| sayings.get("fox"); // undefined | |
| sayings.has("bird"); // false | |
| sayings.delete("dog"); | |
| sayings.has("dog"); // false |
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 server = require("./server"); | |
| var router = require("./router"); | |
| server.start(router.route); //Injecting router as parameter. |
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 http = require("http"); | |
| //Ways to print JSON per console: | |
| console.log('http: '+http); | |
| console.log(JSON.stringify(http, null, 4)); | |
| console.log(JSON.parse(JSON.stringify(http, null, 4))); |
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
| //*************************** | |
| //sayhello.js | |
| var sayhello1 = function() { }; | |
| var sayhello2 = function() { }; | |
| exports.sayhello1 = sayhello1; | |
| exports.sayhello2 = sayhello2; | |
| //index.js | |
| var x = require('./sayhello.js'); | |
| x.sayhello1(); |
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
| <span><script>document.write(name+' '+middlename+' '+ lastname)</script></span> | |
| <span><script>getQueryVariable("n");</script></span> |
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
| <div class="load-container"> | |
| <img src="img/logo.gif" alt="logo" class="loading"/> | |
| </div> | |
| <div> | |
| <img src="img/sequence/Frame0001.jpg" alt="" class="sequence" id="myimg"> | |
| </div> |
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 express = require('express'); | |
| var app = express(); | |
| var server = app.listen(3000); | |
| function logger(req,res,next){ | |
| console.log(new Date(), req.method, req.url); | |
| next(); | |
| } |
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
| <div class="list-group"> | |
| <!-- loop over blog posts and render them --> | |
| <% posts.forEach((post) => { %> | |
| <a href="/post/<%= post.id %>" class="list-group-item"> | |
| <h4 class="list-group-item-heading"><%= post.title %></h4> | |
| <p class="list-group-item-text"><%= post.author %></p> | |
| </a> | |
| <% }) %> | |
| </div> |
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
| 'use restrict'; | |
| /** | |
| * Local module dependences. | |
| */ | |
| var db = require('./db'); | |
| /** | |
| * Function that get all data entered in the signup form, check if user exist calling db.engine.findByUsername() function. Return the properly messages to the view according if user exist and password match. | |
| * |