ES6 / ES2015 Additions
Arrow functions (or fat functions)?Arrow functions (or fat functions)
An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this
, arguments
, super
, or new.target
keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.
The key difference, despite being shorter to write, is that arrow functions do not create their own value for ‘this’.
If the function body contains just a single statement, you can omit the brackets and write all on a single line:const myFunction = () => doSomething()
https://flaviocopes.com/javascript-arrow-functions/
(parameters) => { statements }
Arrow functions and Lexical this
https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4
Template Strings / Template Literals
https://wesbos.com/javascript-template-strings/
Object Destructuring
https://dev.to/sarah_chima/object-destructuring-in-es6-3fm
Adding to Array
[…oldArray, itemToAdd]
Javascript Style Guide at Airbnb
Modern PHP Without Framework
Difference between forward proxy and reverse proxy
A simple todo app in javascript
Asked in Box onsite interview. With a node.js server on backend.
$().ready(function() { $('#add').on('click', addTask); $('#tasks').on('click', markComplete); // Alternative way // var tasksElement = document.getElementById('tasks'); // tasksElement.addEventListener('click', markComplete); //document.getElementById('task-input').onkeydown = function(e){ $('#task-input').on('keydown', function(e) { if(e && e.keyCode == 13){ addTask(); } }); function renderTask(result) { var checkboxContainerId = 'check' + result.id; var taskTextId = 'tasktext-' + result.id; if (result.done == '1') { checkedState = ' checked '; } else { checkedState = ''; } taskHtml = '
System Design Resources
Grokking the System Design Interview
https://www.educative.io/collection/5668639101419520/5649050225344512
Atlassian Hackerrank Interview
1) Implement a method ‘find’ that will find the starting index (zero based) where the second list occurs as a sub-list in the first list. It should return -1 if the sub-list cannot be found. Arguments are always given, not empty.
Authentication for REST Apis
Combinations of a String
Implement a function that prints all possible combinations of a string.
A string “12” is the same as string “21”.
Note : The below function will work for unique strings like “wxyz” but not for “aabc”. One quick to fix it for “aabc” would be to store the output strings in a hash and then output the hash.
Check this video for good explanation of “AABC” :
function combine($instr, $outstr, $index) { for ($i = $index; $i < strlen($instr); $i++) { $outstr = $outstr . $instr[$i]; echo "$outstr\n"; combine($instr, $outstr, $i + 1); $outstr = substr($outstr, 0, -1); } } combine("wxyz", "", 0);