| *** shmohamud has quit (Ping timeout: 480 seconds) | 01:06 | |
| *** scooper has quit (None) | 04:48 | |
| *** shmohamud has quit (Ping timeout: 480 seconds) | 09:08 | |
| fkoikoi | Good Morning Jeff | 11:00 |
|---|---|---|
| *** fkoikoi has quit (Remote host closed the connection) | 11:00 | |
| *** fkoikoi_ has quit (Remote host closed the connection) | 11:02 | |
| *** jelkner has quit (Quit: Leaving) | 11:06 | |
| *** dcammue_ has quit (None) | 11:07 | |
| *** fkoikoi_ has quit (Ping timeout: 480 seconds) | 11:19 | |
| *** fkoikoi_ has quit (Quit: Leaving) | 12:50 | |
| scooper | Good afternoon Sahnun | 20:25 |
| scooper | how was work today??? | 20:25 |
| shmohamud | Good evening Spencer | 20:26 |
| shmohamud | it was excellent, thanks for asking | 20:26 |
| shmohamud | Did you complete the homework I assigned? | 20:26 |
| scooper | Unfortunately I could locate the assignment where I save, can you please paste it again..... | 20:27 |
| shmohamud | It's in the IRC logs | 20:28 |
| shmohamud | Write two arrow functions. The first one should not include a return statement and the second one should have multiple lines and include a return statement. | 20:29 |
| shmohamud | Can you do it now? | 20:29 |
| scooper | let me check | 20:29 |
| scooper | ok thanks, let me attempt doing it | 20:29 |
| scooper | const mutiplication = (a,b)=>{ | 20:33 |
| scooper | console.log(a+b) | 20:33 |
| scooper | } | 20:33 |
| scooper | mutiplication(4,5); | 20:33 |
| *** shmohamud has quit (Remote host closed the connection) | 20:35 | |
| scooper | const mutiplication = (a,b)=>{ | 20:36 |
| scooper | c = a+b; | 20:36 |
| scooper | d = a+b; | 20:36 |
| scooper | return c | 20:36 |
| scooper | } | 20:36 |
| scooper | mutiplication(4,5); | 20:36 |
| scooper | sorry error | 20:36 |
| shmohamud | so for the multiplication function, are you multiplying or adding inside of it? | 20:36 |
| scooper | const mutiplication = (a,b)=>{ | 20:37 |
| scooper | c = a+b; | 20:37 |
| scooper | return c | 20:37 |
| scooper | } | 20:37 |
| scooper | mutiplication(4,5); | 20:37 |
| scooper | oh | 20:37 |
| scooper | it was a mistake | 20:37 |
| scooper | const mutiplication = (a,b)=>{ | 20:38 |
| scooper | c = a*b; | 20:38 |
| scooper | return c | 20:38 |
| scooper | } | 20:38 |
| scooper | mutiplication(4,5); | 20:38 |
| shmohamud | perfect, now how about an arrow function without curly braces and no return statement? | 20:38 |
| scooper | ok | 20:39 |
| scooper | let me attempt it | 20:39 |
| shmohamud | actually, can you start by setting some variables equal to both of the multiplication functions? | 20:39 |
| scooper | S | 20:39 |
| shmohamud | Let's see what happens when you have no return statement vs. having a return statement | 20:39 |
| scooper | do you I should use comparison operator in my function??? | 20:40 |
| shmohamud | so for one of them, remove "return c" | 20:40 |
| scooper | DO you mean I should use comparison operator in my function | 20:40 |
| shmohamud | No need to use comparison operator | 20:40 |
| shmohamud | I mean set testVariable = multiplication(3,4) | 20:40 |
| scooper | ooh got you now | 20:41 |
| shmohamud | and then testVariableTwo = otherMultiplication(3,4) | 20:41 |
| *** shmohamud has quit (Remote host closed the connection) | 20:45 | |
| scooper | const mutiplication = (a,b)=> | 20:47 |
| scooper | c = a+b; | 20:47 |
| scooper | testVariable= mutiplication(4,5); | 20:47 |
| shmohamud | sorry my laptop fell asleep. Did you paste your results yet? | 20:47 |
| scooper | yes | 20:47 |
| scooper | const mutiplication = (a,b)=> | 20:47 |
| scooper | c = a+b; | 20:47 |
| scooper | testVariable= mutiplication(4,5); | 20:47 |
| scooper | please hold on | 20:48 |
| shmohamud | ok | 20:48 |
| scooper | it make a mistake in the naming convention | 20:48 |
| shmohamud | ok | 20:48 |
| scooper | const mutiplication = (a,b)=> | 20:48 |
| scooper | c = a*b; | 20:48 |
| scooper | testVariable= mutiplication(4,5); | 20:48 |
| scooper | here is it | 20:48 |
| shmohamud | what do you expect testVariable to equal? | 20:49 |
| scooper | 20 | 20:49 |
| shmohamud | run it and let me know what you get | 20:50 |
| scooper | It got 20 | 20:50 |
| shmohamud | one momen | 20:50 |
| shmohamud | one moment | 20:50 |
| scooper | const mutiplication = (a,b)=> | 20:50 |
| scooper | c = a*b; | 20:50 |
| scooper | testVariable= mutiplication(4,5); | 20:50 |
| scooper | 20:50 | |
| scooper | 20 | 20:50 |
| scooper | are you still there?? | 20:53 |
| shmohamud | yes | 20:53 |
| shmohamud | that was a good job. I was surprised myself because I thought it would return undefined but clearly it's 20 | 20:53 |
| shmohamud | you're correct | 20:53 |
| shmohamud | it makes sense because it has no curly braces and returns whatever the single line is, in this case that would be "c" which equals 4*5 | 20:54 |
| scooper | Can I say something | 20:54 |
| shmohamud | of course | 20:54 |
| scooper | First I ran the code without the curly bracket and kept the return statement in the arrow function it give me an output of undefined | 20:55 |
| scooper | so I remove the return statement and ran the program it, it give me 20 | 20:55 |
| scooper | *again | 20:56 |
| shmohamud | Good job testing that out, I'm not sure why having a return statement would make it undefined without curly brackets. When there are no brackets on an arrow function, it returns whatever the line of code is | 20:57 |
| shmohamud | I thought return statements are not allowed for single line arrow functions without curly brackets | 20:58 |
| shmohamud | This is what i get when i run that | 20:58 |
| shmohamud | SyntaxError: Unexpected token 'return' | 20:58 |
| shmohamud | I don't think return statements are allowed if it's an arrow function without curly brackts | 20:59 |
| scooper | which code??? give you that error msg | 20:59 |
| shmohamud | const multiplyyy = (a,b) => return c=a*b | 20:59 |
| scooper | Shanun | 21:02 |
| shmohamud | yes | 21:02 |
| scooper | if you do it like this, it will work | 21:02 |
| scooper | const mutiply = (a,b) => c = a*b | 21:02 |
| scooper | testAndSee = mutiply(4,5) | 21:02 |
| shmohamud | yes, I know that works, but you said you got undefined with the return statement...? | 21:03 |
| shmohamud | I was wondering how that's possible. Maybe you got a syntax error like me? | 21:03 |
| scooper | yes | 21:03 |
| scooper | let me run that previous program and post the error mgs | 21:04 |
| shmohamud | I'll be right back | 21:04 |
| scooper | ok | 21:04 |
| shmohamud | in the meantime I want you to write an arrow function with curly brackets with a return statement, and then without a return statement. Compare the values of them. | 21:04 |
| shmohamud | ok I'm back | 21:07 |
| *** shmohamud has quit (Remote host closed the connection) | 21:11 | |
| scooper | const learning = (message) => { | 21:14 |
| scooper | return message | 21:14 |
| scooper | 21:14 | |
| scooper | } | 21:14 |
| scooper | testing = learning("Let learn to code together") | 21:14 |
| scooper | 'Let learn to code together' | 21:14 |
| scooper | const learning = (message) => { | 21:15 |
| scooper | message | 21:15 |
| scooper | 21:15 | |
| scooper | } | 21:15 |
| scooper | testing = learning("Let learn to code together") | 21:15 |
| scooper | undefined | 21:15 |
| shmohamud | Perfect | 21:16 |
| shmohamud | do you see the difference when we use the return statement vs when we don't? | 21:16 |
| scooper | yes | 21:16 |
| shmohamud | in javascript function declarations AND arrow functions with curly brackets, we must have the return statement in there or else it will always return undefined | 21:17 |
| shmohamud | Ok, do you have any questions for me before we call it a day here? | 21:18 |
| scooper | I will send my question later not now I m a bit exhausted now | 21:19 |
| scooper | before you leave | 21:19 |
| shmohamud | Sounds good. | 21:19 |
| shmohamud | Yes? | 21:19 |
| scooper | When are we moving on to the next topic??? | 21:20 |
| shmohamud | once we're solid on function declarations and arrow functions. I think next session we can continue to logical operators and conditionals (==, ===, >=, <=, ||, &&, if, else, else if, switch) | 21:21 |
| scooper | perfect switch might be the only conditional statement see complicated for me | 21:22 |
| shmohamud | ok, but the syntax for JS is different from python, it might take some getting used to | 21:23 |
| scooper | I been practicing Sahnun | 21:23 |
| scooper | especially understanding the differences between double equal and triple equal | 21:23 |
| shmohamud | I can tell, keep up the good work. We have a lot of work left to get you to professional level JS master | 21:24 |
| scooper | double pipe is the same as or operator in python | 21:24 |
| shmohamud | good | 21:24 |
| scooper | && is the same a and operator in python | 21:24 |
| scooper | Shanun is ternary operator often use in js?? | 21:26 |
| shmohamud | awesome, it should come easy next time | 21:26 |
| shmohamud | It's used enough that it's important to know | 21:26 |
| shmohamud | if (condition)? A : B | 21:26 |
| scooper | It's a bit confusing, when I came across it | 21:27 |
| scooper | But will figure how to get around it in the shortest possible time... | 21:27 |
| shmohamud | Don't worry, you will get it soon. It's not too different from other conditional logic. | 21:28 |
| shmohamud | if(condition) ? [do this] : [do this] | 21:28 |
| shmohamud | if it's true, do the first one, if it's false, do the second one | 21:28 |
| scooper | ok | 21:29 |
| scooper | thanks Shmohamud can I get a nap now?? it 9:30pm on my end??? | 21:30 |
| shmohamud | You're welcome. Keep up the good work. We'll meet again tomorrow or Monday. | 21:30 |
| scooper | OK thanks | 21:30 |
| scooper | ACTION signing out for now | 21:30 |
| *** scooper has quit (Quit: Leaving) | 21:30 | |
| *** shmohamud has quit (Remote host closed the connection) | 21:31 | |
| *** shmohamud has quit (Remote host closed the connection) | 23:36 | |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!