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
var str = "the quick brown fox jumped over the lazy dog"; | |
var arr = str.split(' '); | |
var titleArr = arr.map(function(x){ | |
return x.charAt(0).toUpperCase() + x.slice(1); | |
}); | |
var titleStr = titleArr.join(' '); | |
console.log(titleStr); |
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
/* Reading https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch1.html | |
* I have a differing opinion. Please help in sorting it out. | |
*/ | |
// Original code : or I think wrong way to to Object Oriented code. | |
var Flock = function(n) { | |
this.seagulls = n; | |
}; |
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
// Using stricter env | |
'use strict'; | |
// our object; does only one thing. | |
var obj = { | |
getMe: function() { | |
return this; | |
} |
NewerOlder