i break down what the language or library is actually doing into small, byte (heh) sized terms i can understand, then i try to recreate everything piece by piece until i have the whole unit.
then i apply it to a bigger project.
for a while i struggled with ecmascript fat-arrow functions. these:
what i did to understand was that i went into open-source code, codeacademy, freecodecamp, etc. code sources and looked at big code, for example, something copied and pasted from a codeacademy page:
const multiplyByNineFifths = (celsius) => {
return celsius * (9/5);
};
const getFahrenheit = (celsius) => {
return multiplyByNineFifths(celsius) + 32;
};
console.log('The temperature is ' + getFahrenheit(15) + '°F');
// Output: The temperature is 59°F
when i first saw this, i had some vague idea of where everything was, but i didnt know the specifics. thats what messes you up. always. the specifics. so i looked closely.
this is taken from the express 2.x start page, because im too lazy to convert the current fat-arrow back to this format.
i broke the function down. im calling get on app, which is just an alias for telling express to make a server. get takes parameters of a route, which is /, and then a function telling it what to do with this route being used.
then there was clarity because i took myself through what this whole thing was made of, how to remake it, and what every important part of it did, by thinking about it critically
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
i break down what the language or library is actually doing into small, byte (heh) sized terms i can understand, then i try to recreate everything piece by piece until i have the whole unit.
then i apply it to a bigger project.
for a while i struggled with ecmascript fat-arrow functions. these:
what i did to understand was that i went into open-source code, codeacademy, freecodecamp, etc. code sources and looked at big code, for example, something copied and pasted from a codeacademy page:
when i first saw this, i had some vague idea of where everything was, but i didnt know the specifics. thats what messes you up. always. the specifics. so i looked closely.
so, the function is first declared like a variable, with
const
at the start and a semicolon at the end. alright, ill think of this like a variable.okay, so, after
const
theres a name, just like declaring a variable, as if i declaredconst multiplyByNineFifts = what-the-value-should-be
.its like a variable but dynamic. you can do things with this variable.
what i did after breaking it down like this and understanding it was that i tried converting normal functions into this syntax. for example:
this is taken from the express 2.x start page, because im too lazy to convert the current fat-arrow back to this format.
i broke the function down. im calling
get
onapp
, which is just an alias for tellingexpress
to make a server.get
takes parameters of a route, which is/
, and then a function telling it what to do with this route being used.so this is just like typing
alright, let me convert this to fat-arrow syntax:
let me plug it back in, like with math:
then there was clarity because i took myself through what this whole thing was made of, how to remake it, and what every important part of it did, by thinking about it critically