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
| //Information hiding | |
| function User(){ | |
| var username = "Jineesh"; | |
| this.getName = function(){ | |
| return username; | |
| } | |
| } | |
| var u = new User(); | |
| u.getName(); |
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 LinkedList(){ | |
| this.head = null; // can be replaced with class or model (to have strong type) | |
| this.tail = null; | |
| var count = 0; | |
| this.AddFirst = function(node){ | |
| //Save off the head node so we dont lose it | |
| var temp = this.head; | |
| //Point head to the new node |
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 fibo(n) { | |
| var f = []; | |
| for (var i = 0; i < n; i++ ) { | |
| var item = (i < 2) ? i : f[i-1] + f[i-2]; | |
| f.push(item); | |
| } | |
| return f; | |
| } | |
| var fibos = fibo(5); |
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 seen = [] | |
| JSON.stringify(components[0], function(key, val) { | |
| if (typeof val == "object") { | |
| if (seen.indexOf(val) >= 0) | |
| return | |
| seen.push(val) | |
| } | |
| return val | |
| }) |
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 f1(cb){ | |
| console.log("I am f1"); | |
| cb(); | |
| } | |
| function f2(cb){ | |
| console.log("I am f2"); | |
| cb() | |
| } | |
| function f3(){ | |
| console.log("I am f3"); |
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
| define(function(require){ | |
| 'use strict'; | |
| var React = require('react'); | |
| var store = require('./store'); | |
| var RegisterForm = require('es6!./registerForm'); | |
| var VerifyForm = require('es6!./verifyForm'); | |
| var RegisterSuccess = require('es6!./registerSuccess'); | |
| var Stepper = require('es6!./stepper'); | |
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 responseJson = [ | |
| {type: 'input', id: 'key1', styles:{display:'block', color: 'red'}, someprop:'abc', someotherprop:'bcd'}, | |
| {type: 'radio', id: 'key2', styles:{display:'inline', color: 'blue'}, someprop:'xyz', someotherprop:'z'} | |
| ] | |
| var parseResponse = function(response) { | |
| var result = []; | |
| for (var i=0; i<response.length; i++) { | |
| var resultObj = { | |
| type: response[i].type, |
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 responseJson = [ | |
| {type: 'input', id: 'key1', styles:{display:'block', color: 'red'}, someprop:'abc', someotherprop:'bcd'}, | |
| {type: 'radio', id: 'key2', styles:{display:'inline', color: 'blue'}, someprop:'xyz', someotherprop:'z'} | |
| ] | |
| var parseResponse = function(response) { | |
| var result = []; | |
| for (var i=0; i<response.length; i++) { | |
| var resultObj = { | |
| type: response[i].type, |
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
| // Chaining | |
| var lyrics=[ | |
| {line:1,words:"Im a lumberjack and Im okay"}, | |
| {line:2,words:"I sleep all night and I work all day"}, | |
| {line:3,words:"Hes a lumberjack and hes okay"}, | |
| {line:4,words:"He sleeps all night and he works all day"} | |
| ]; | |
| var values = _(lyrics).chain() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.