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 moveZeros = function (arr) { | |
// move zeroes to end | |
} | |
console.log(moveZeros([0,1,0,2,0,1,0,1,0,3,0,1])); | |
console.log(moveZeros([0,0,null,1,0,'a',2,'e',0,1,0,false,1,{},0,3,[],'b',0,1])); |
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
user |
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
// Service | |
module.exports = { | |
createUser: createUser | |
}; | |
function createUser(req, res, next) { | |
return User.findOne({neki id}) | |
.then(user => { | |
if (user.exists) return res.status(500).send('zajebo si'); | |
}) |
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
function generateSections(content) { | |
var sections = []; | |
var section = {}; | |
var subsection = {}; | |
var contentSplit = content.split('<h1>'); | |
for(index in contentSplit) { | |
if (contentSplit[index].indexOf('</h1>') !== -1) { | |
section = {}; | |
section.title = contentSplit[index].substring(0, contentSplit[index].indexOf('</h1>')); | |
contentSecondSplit = contentSplit[index].split('<h2>'); |
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
function addTwoNumbers(x, y) { | |
return x + y; | |
} | |
console.log(addTwoNumbers(5, 1)); |
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
function addTwoNumbers(x, y) { | |
return x + y; | |
} | |
function testAddTwoNumbers() { | |
var x = 5; | |
var y = 1; | |
var sum1 = x + y; | |
var sum2 = addTwoNumbers(x, y); |
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
function addTwoNumbers(x, y) { | |
return x + y; | |
} | |
function testAddTwoNumbers() { | |
// 1. ARRANGE | |
var x = 5; | |
var y = 1; | |
var sum1 = x + y; |
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 assert = { | |
equal: function(firstValue, secondValue) { | |
if (firstValue != secondValue) | |
throw new Error('Assert failed, ' + firstValue + ' is not equal to ' + secondValue + '.'); | |
} | |
}; | |
function addTwoNumbers(x, y) { | |
return x + y; | |
} |
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 assert = require('assert'); | |
function addTwoNumbers(x, y) { | |
return x + y; | |
} | |
function testAddTwoNumbers() { | |
var x = 5; | |
var y = 1; | |
var sum1 = x + y; |
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
function addTwoNumbers(x, y) { | |
return x + y; | |
} | |
module.exports = addTwoNumbers; |
OlderNewer