What Would Be The Output Of This JS Code (pics) - Programming (2) - Nairaland
Nairaland Forum › Science/Technology › Programming › What Would Be The Output Of This JS Code (pics) (1892 Views)
| Re: What Would Be The Output Of This JS Code (pics) by tensazangetsu20(m): 8:57am On Jul 04, 2022 |
airsaylongcome:Actually this isn't valid in java even with the inclusion of car in java 10. You have just equals and == but apex has it. It's pretty much an extension of java and used in Salesforce development. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_operators_understanding.htm I always thought java had that as I have used that a lot in Apex which is also strongly typed. |
| Re: What Would Be The Output Of This JS Code (pics) by jbreezy: 9:14am On Jul 04, 2022 |
JoyousFurnitire:ooh my bad..I was half-sleepy |
| Re: What Would Be The Output Of This JS Code (pics) by remi1444: 9:49am On Jul 04, 2022 |
airsaylongcome:good morning boss ![]() |
| Re: What Would Be The Output Of This JS Code (pics) by Deicide: 10:24am On Jul 04, 2022 |
tensazangetsu20:Since when did java have triple equal to? Oh I see you corrected yourself up there ![]() |
| Re: What Would Be The Output Of This JS Code (pics) by excanny: 10:32am On Jul 04, 2022 |
sixpathsofpain:The first “if” is a validation of the input so a user doesn’t enter 1 as a value. |
| Re: What Would Be The Output Of This JS Code (pics) by airsaylongcome: 11:50am On Jul 04, 2022 |
remi1444:No worry. I go holla you as soon as I reach GIG |
| Re: What Would Be The Output Of This JS Code (pics) by airsaylongcome: 11:56am On Jul 04, 2022 |
excanny:Not correct. It's not validating the user Input. It's checking for the "Base Case" for the factorial function. If the user enters 1 as input, 1!=1 and the if will correctly return 1 as the factorial of 1. This function requires some knowledge of the factorial function to understand what it is doing. Basically n! is equal to n*(n-1)!. That is 5! for example is equal to 5*4!. 5!=5*4*3*2*1 and 4!=4*3*2*1 so 5! Is 5 times 4! |
| Re: What Would Be The Output Of This JS Code (pics) by Nobody: 12:22pm On Jul 04, 2022 |
airsaylongcome:Lols...it's actually not this complicated jeez. This should be the most complicated answer to the most basic question ever. It shows you yourself don't understand what's happening there ![]() |
| Re: What Would Be The Output Of This JS Code (pics) by JoyousFurnitire(m): 1:28pm On Jul 04, 2022 |
sixpathsofpain:You can actually learn HTML5 and JavaScript side by side. You just have to create a time table. Say 2 hrs for each paper day. It's possible. Just don't overthink what you don't get ask questions. If you know you can't take all together then take it one by one from html, css and JS. For CSS focus on layout with flex-box or CSS grid (refer to this post when you get there). Learn CSS very well before moving to other libraries. Take it easy on yourself. For outline, visit freecodecamp(dot)org PS: There're many great peeps on here no mind that Igboman him just to catch cruise ![]()
|
| Re: What Would Be The Output Of This JS Code (pics) by airsaylongcome: 1:46pm On Jul 04, 2022 |
GREATIGBOMAN:Very wordy, yes. But it's a basic straight forward recursive solution of factorial function. Calls itself each time reducing the input to the function by one. Until it gets to the vase case of 1 and then like a stack, "pops" every previous call. Na textbook stuff. Maybe my previous explanation was too convoluted, but this function is too basic for me not to know |
| Re: What Would Be The Output Of This JS Code (pics) by Karleb(m): 2:15pm On Jul 04, 2022 |
airsaylongcome:It's basically the first thing everyone learns when learning recursion. |
| Re: What Would Be The Output Of This JS Code (pics) by sixpathsofpain(op): 2:40pm On Jul 04, 2022 |
JoyousFurnitire:Thanks alot bro. Really appreciate. Just one question others libraries like ? PHP ? Or what |
| Re: What Would Be The Output Of This JS Code (pics) by JoyousFurnitire(m): 2:45pm On Jul 04, 2022 |
sixpathsofpain:Other CSS libraries like Bootstrap. Also same with JavaScript, master and learn the basics very well before jumping to libraries like React. PHP is a programming language like JavaScript. |
| Re: What Would Be The Output Of This JS Code (pics) by sixpathsofpain(op): 3:03pm On Jul 04, 2022 |
JoyousFurnitire:Bro may God almighty continue to bless you for people like us. Please just a few more question I'd like to ask( lastest, I promise )1.) Do you suggest I change OS from WINDOWS to LINUX ( to prevent unnecessary crashing since Linux is more light weight) 2.) Should I create a github account or repo now or when I'm ready to start building projects 3.) Like how long would it take me to become a junior full-stack developer if I studied seriously for 5 hours minimum a day ? Im thinking maybe after 1year and five months.. |
| Re: What Would Be The Output Of This JS Code (pics) by JoyousFurnitire(m): 3:52pm On Jul 04, 2022 |
sixpathsofpain:1) Windows is fine 2) Yes learn git and GitHub early 3) It depends on you. Set your timeframe. |
| Re: What Would Be The Output Of This JS Code (pics) by namikaze: 4:31pm On Jul 04, 2022 |
jbreezy:Oh, I see. Op should do due diligence to the basics first. |
| Re: What Would Be The Output Of This JS Code (pics) by Nine2ten: 7:58pm On Jul 04, 2022 |
6 Recursive 3 X 2 X 1 |
| Re: What Would Be The Output Of This JS Code (pics) by Lasmarr: 10:11pm On Jul 04, 2022 |
sixpathsofpain:that n is 3 and n - 1 = 2 |
| Re: What Would Be The Output Of This JS Code (pics) by captainbangz: 7:36am On Jul 05, 2022 |
sixpathsofpain:if the first 'if' condition isn't there, ftl(1) will return 0. whereas, even the factorial of zero is 1. That if condition alone doesn't even make that solution correct, because ftl(0) will return zero instead of 1. |
| Re: What Would Be The Output Of This JS Code (pics) by airsaylongcome: 12:00pm On Jul 06, 2022 |
remi1444:Your Bible verse shock me. Sorry abeg. I'm doing a 16 hour rotation now so I no dey sleep well again. Unfailingly sending tomorrow. No vex abeg.
|
| Re: What Would Be The Output Of This JS Code (pics) by remi1444: 4:02pm On Jul 06, 2022 |
airsaylongcome: na me dey beg so I need dey persistent and “worrisome”. Thank you boss for previous and future. I appreciate it. |
| Re: What Would Be The Output Of This JS Code (pics) by The5DME(m): 4:17pm On Jul 06, 2022 |
remi1444:Thank you boss too, for the future ![]() |
As A Programmer, What Will Be The Output Of This Code? • I Asked Chatgpt To Write A Poem About Nairaland. Here's The Output • Wrote My First JS Code On VS Code.... Lol (pics) • 2 • 3 • 4
Java Sms • C • Y Don't Ppl Use Text Based Browsers 4 Saving Data/Money (My Research On NL)?




) so now I'm planning on quitting JAVASCRIPT for now, to go focus on HTML first then CSS before continuing JAVASCRIPT and then what ever should follow (for me to become full-stack) would you advise me to quit JavaScript now and go focus on those (HTML and CSS) or I can continue with JAVASCRIPT before HTML and CSS?