Stats: 3,184,280 members, 7,923,313 topics. Date: Friday, 16 August 2024 at 11:18 PM |
Nairaland Forum / Science/Technology / Programming / I Can Code In 75 Languages!!! (14882 Views)
Learning To Code In Naijarea / I Need Online Banking Source Code In PHP, MSQL / Online Banking Source Code In PHP, MSQL (2) (3) (4)
(1) (2) (3) (4) (5) (6) (7) (Reply) (Go Down)
Re: I Can Code In 75 Languages!!! by FincoApps(m): 8:44am On Jul 20, 2016 |
KazukiIto: Dude, whether you like it or not, you must use the result of other people work.... it does not make you lazy. That's why there are scientists.... they help to discover things and easier ways to do things. People like you that want to do everything the hard way would be a scientist, but your works would probably be only taught when you are long gone... So I and most other programmers prefer not to be scientists and use what the other scientists has made |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 2:10am On Jul 22, 2016 |
DanielTheGeek: Your onclick event needs review Cos even without running the code, I can tell from experience that "this" as an argument won't give u the name of the id but will rather return it as an html object. also, u can't place "this" and another argument that way together. there is a trick to doing that. There's every possibility that this code won't run properly. |
Re: I Can Code In 75 Languages!!! by Nobody: 3:54am On Jul 22, 2016 |
^^^Interesting, visual debuggers ni awon eleyi o. |
Re: I Can Code In 75 Languages!!! by Nobody: 8:10am On Jul 22, 2016 |
godofbrowser: Well, run it first and find out by yourself not with your mouth. |
Re: I Can Code In 75 Languages!!! by Nobody: 8:41am On Jul 22, 2016 |
DanielTheGeek:*coughs* ever heard of a code-to-mouth-debugger engine! 1 Like |
Re: I Can Code In 75 Languages!!! by Craigston: 9:42am On Jul 22, 2016 |
godofbrowser:You're correct. The html object is return to the parameter 'h' in the showLangs function. The code will run properly but the 'var b' is unused and should be removed. 2 Likes |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 9:45am On Jul 22, 2016 |
DanielTheGeek: I don't think that would be necessary. Reasons The poster created a variable "b" on line 44 in a wrong way which would never work with that kinda onclick function you have on line 28. He probably figured out his code was wrong and used h.style on line 50 instead of the declared "b". It's important to note that "getElementById( h )" won't give u "getElementById( 'button' )", rather it will produce "getElementById( HTMLDomObject )" and this object ought to be used directly the way he later did on line 50. The code works. I like his code cos i'm a fan of short clean codes, but then this error was almost a serious issue. 3 Likes
|
Re: I Can Code In 75 Languages!!! by Nobody: 10:15am On Jul 22, 2016 |
O boy, see code battle as e dey go o! |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 10:43am On Jul 22, 2016 |
dhtml18: lol... na comedy u come do today abi |
Re: I Can Code In 75 Languages!!! by Nobody: 12:08pm On Jul 22, 2016 |
godofbrowser:funny |
Re: I Can Code In 75 Languages!!! by tr3y(m): 1:51pm On Jul 22, 2016 |
Should have pass in the event object instead of this 1 Like |
Re: I Can Code In 75 Languages!!! by Nobody: 4:30pm On Jul 22, 2016 |
godofbrowser: I'm impressed with your review, I never consciously noticed that error... but I probably figured out it won't run If i used the b variable...my spider sense saw that coming ![]() @godofbrowser I would have downvoted your review if NairaLand had that feature, because the code will still run properly and the presence of only one unused variable/bad variable doesn't make the whole thing useless. |
Re: I Can Code In 75 Languages!!! by Nobody: 4:43pm On Jul 22, 2016 |
tr3y: Yeah, I know right |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 6:18pm On Jul 22, 2016 |
DanielTheGeek: I haven't said the whole thing is useless and even if it is, I am not in position to point that out. I saw something that's worth reviewing and I did, I could equally decide to ignore. furthermore, I'm wondering what you're trying to pass across by " I wrote this code online in some few minutes without even running it". whichever way, I'll simply advice myself. 2 Likes |
Re: I Can Code In 75 Languages!!! by Nobody: 6:21pm On Jul 22, 2016 |
see code geeks showing themselves. . . |
Re: I Can Code In 75 Languages!!! by Craigston: 6:57pm On Jul 22, 2016 |
tr3y:It's actually better -- a good practice -- to avoid using event triggers and the 'event' object, except there's no other option. Using event handlers and element queries is better and your program's behavior should be predictable. |
Re: I Can Code In 75 Languages!!! by tr3y(m): 8:13pm On Jul 22, 2016 |
Craigston:Well whatever works bro. I might decide to pass in the whole DOM tree and transverse it till I find the node I'm interested in. |
Re: I Can Code In 75 Languages!!! by FincoApps(m): 9:21pm On Jul 22, 2016 |
Craigston: Why ? And please give a clear reason... |
Re: I Can Code In 75 Languages!!! by Nobody: 10:13pm On Jul 22, 2016 |
FincoApps:Reason: it is good and recommended practice. |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 11:01pm On Jul 22, 2016 |
dhtml18: lol |
Re: I Can Code In 75 Languages!!! by Nobody: 11:03pm On Jul 22, 2016 |
godofbrowser:I think his ears are not working well, so i have to help him pull it. |
Re: I Can Code In 75 Languages!!! by KazukiIto(m): 1:11pm On Jul 23, 2016 |
Yes! What did I miss? |
Re: I Can Code In 75 Languages!!! by tr3y(m): 1:29pm On Jul 23, 2016 |
KazukiIto:road 1 Like |
Re: I Can Code In 75 Languages!!! by Nobody: 1:43pm On Jul 23, 2016 |
KazukiIto:You missed a whole boatload of trollin' |
Re: I Can Code In 75 Languages!!! by KazukiIto(m): 1:46pm On Jul 23, 2016 |
dhtml18:Indeed. I've nothing to contribute so, continue... |
Re: I Can Code In 75 Languages!!! by KazukiIto(m): 2:16pm On Jul 23, 2016 |
FincoApps:You are missing the whole point. I said "there is no soul in hackerism anymore. Everyone is just interested in "copying" and "pasting" calculator programs in the name of having a portfolio. No clever solutions." Vim is an 'improvement' to vi which also is an improvement to ed, which Bill Joy categorically stated that he copied parts of the code from somewhere. Bash (Bourne Again Shell) is a remake of the Bourne shell which gave it some features of csh, ksh ... One thing stands, they improved on the solutions of the old program. That's where I'm striking from. We 'build on' the results of other's discovery, that's how science progress like you rightly mentioned. We are not seeing clever solutions any longer is what I'm ranting about. Ps: sorry for answering this now, had issues with my acct. 1 Like |
Re: I Can Code In 75 Languages!!! by Craigston: 3:18pm On Jul 23, 2016 |
dhtml18:That was real scolding for FincoApps. What do you have to say, finco? FincoApps:Just think about what happens when you're trying to manage many click events across different versions of a site design and you're using only the 'event' object to determine what event it is and, if it's a click event, which HTML object was clicked. It becomes harder to manage as it grows larger, even with your debugging tools to help. Attaching event triggers to each object of interest makes it easier to manage. |
Re: I Can Code In 75 Languages!!! by tr3y(m): 4:57pm On Jul 23, 2016 |
Craigston:Who does that? Listen to all event then use the event Object to determine what event it is? You create event handlers before even thinking of passing the Object You listen for an event and once it occurs you have your callback to which you pass in the event Object. that is why we have stopPropagation and preventDefault, how will you make use of them if you don't pass in the event Object to your callback? |
Re: I Can Code In 75 Languages!!! by Craigston: 5:47pm On Jul 23, 2016 |
tr3y:Of course you can still use stopPropagation and preventDefault. And it's not different from listening to an event. It only helps you write cleaner, more maintainable code and separates behavior, presentation and structure. Using html event trigger attributes such as onClick, onBlur, etc mix more JavaScript into your html which should be avoided. Instead of using those, query the elements you're interested in and use addEventListener() to attach event handlers to them. That makes your code more readable. It becomes clearer on first glance what your function is meant to achieve. Your html becomes free of JavaScript too. I used this technique to write a template for a friend and reading the code was enjoyable. You understand the document structure better since it is almost html alone. Similarly, the JavaScript file was shorter and cleaner. |
Re: I Can Code In 75 Languages!!! by tr3y(m): 7:29pm On Jul 23, 2016 |
Craigston: Okay now I get you. You are a semantic markup crusader ![]() You still have to worry about cross-browser compatibility especially if you are using vanilla JavaScript. |
Re: I Can Code In 75 Languages!!! by godofbrowser(m): 7:44pm On Jul 23, 2016 |
Craigston: You're making sense. Reminds me of when I learnt javascript at first. I enjoyed adding those event handlers like the onClick, onBlur, etc to my html codes. But after learning jquery, I needed no one to tell me that the addEventListener() makes the project more professional. it'll be a pleasure reading more tips of this kind. That's part of the reason i joined NairaLand. Thanks. |
Re: I Can Code In 75 Languages!!! by Nobody: 8:03pm On Jul 23, 2016 |
What have you got to say about this?
|
(1) (2) (3) (4) (5) (6) (7) (Reply)
I Need Advice On How I Can Create A Social Media / Updates From #ForLoopAbuja / What's Programming Lauguage Do You Think Is Best To Start With
Viewing this topic: 1 guest(s)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 5 |