[checklist] - Online courses
“Computer Science is basically the science of tradeoffs.” — Brian Holt
function find(needle, haystack) {
for (var i = 0; i < haystack.length; i++) {
if (haystack[i] === needle) return true;
}
}
// Still O(n). Unless we say otherwise, we're assuming worst case scenario. In this worst case, the needle would be the last element.
function makeTuples(input) {
var answer = [];
for (var i = 0; i < input.length; i++) {
for (var j = 0; j < input.length; j++) {
answer.push([input[i], input[j]]);
}
}
return answer;
}
// This would be O(n²). For every input, we have to go through a full loop inside of another full loop, meaning we're doing a lot of work! This is the trick: look for loops.
Recursion
Recursion is when you define something in terms of itself. Has anyone ever used the word you wanted defined in the definition that they gave you? "What is a computer?" "It's something that computes things." This would be a recursive definition.
wr
in devtool console with CodepenScroll into View
h
key to hide things from viewBreak on
to debug on things like sliderSources
, use prettyPrint
Shift + click
change color formatHold click
for shades of color$0
is what I click in dom treedisable cache
when open devtoolsCall stack
and watch
functions or anonymous functionsblackbox
libraries for call stack
debugger;
to debug js files within fileRG workshop & Chrome Devtools Profiling
vimtutor
vimiim chrome tab
hex (r, g, b)
conditional JS breakpoint in source
beware of jigsaw and memory leak graph pattern
red paint blip means Chrome suspects a page jank
Initial high green is expected. What to worry is a green spike.
Page Jank
Window.requestAnimationFrame()
will-change: transform
Timeline
, and then Heap snapshot
on Profiles
tab. And then check Event Listeners
in Elements
Audits
and Network
tabs.Timeline
, look out for jigsaw pattern especially after GC (garbage collection) kicks in.