r8 my code
Keeping minorities out of tech
Other urls found in this thread:
docs.oracle.com
twitter.com
>r8 my code
shit/10
learn to use filter() you stupid faggot
>what are enums
>what are for each loops
>what are hashmaps
Babby's first code
This
I never understood why I should use "foreach" rather than "for". They're the same thing!(?)
what do I do if I've been coding for 10 years every day but am still shit at it? It makes me question my whiteness.
more like learn how to not use javascript pleb
>american education
>dynaimc programming "language"
>varring anything
>using postfix increment
>using typeof in faggotscript
>using faggotscript
other anons have mentioned legitimate critiques but missed these points
here is legit code for you
discriminate :: [a] -> Bool
discriminate = True
So that fizzbuzz autists don't get triggered
>for and if without closing brackets
this shit can cause mistakes if someone else has to maintain your code and doesn't catch it, stop that shit nigger
>brackets on the same line as the conditional
stop that shit nigger it makes your code harder to read
foreach is more intuitive in a few common cases but yes they're pretty much the same thing
>RETURN A SET OF APPROVED PPL FGT
good job Karlie you are a real coder now!
just code in cursive
>tfw lerning js for over a year and my code isn't much better
xaxaxaxaxaxaxaxa нeдooцeнивaть
map(discriminate, people)
Strong 1 out of 10.
>javascript
trashman.jpg
>heterogenous arrays
>javascript
well, it's time for that state issues euthanasia pill, OP
people.filter(v => parseInt(v))
for some reason people.filter(parseInt) does not work
This. This looks like some starter code that has a changed function name and values.
>going on Jow Forums to get a personal opinion
It's like you want to get your soul crushed.
God that's bad.
Also, JavaScript
>codes jscript
>isnt a fag
>var
>.length in a loop condition
>using a for loop
>not filtering
More optimization needed.
This is my 3rd attempt at code in JS. It's for a school assignment. I'm pretty sure they're gonna get mad at me for it but I thought it'd be funny. I'm actually learning by looking up these criticisms so thanks Jow Forums
>>Jow Forums
You stop being a script kiddie and learn how to write code for real projects.
>USING A LIST INSTEAD OF DICTIONARY
>what even is indentation?
Do us a favor OP and just kys.
>stop that shit nigger it makes your code harder to read.
FUCKING THIS. BRACE WAR NOW!!!!
Fuck jabbascrip.
How tf are you still shit at something you've been working at every day for 10 years? Self-taught I assume? Even then you should have developed some kind of discipline or improved your intuition when it comes to abstraction. Explain yourself
Do you even Node.js? It's non-blocking I/O.
Personally I don't give a shit. The parser knows the next line is the code to execute and imo it looks cleaner. If I have to work with a team then sure I'll do what makes it most readable for them. Why does it matter if brackets are on the same line as the conditional?
Nice.
>JavaScript
It's shit, user.
Also: This shouldn't be on Jow Forums
>javascript
>code
>They're the same thing!(?)
foreach doesn't ensure operation order, user.
Agreed but I thought it'd be funny
For loops typically iterate over a set of numbers while foreach iterates over a collection of objects. In most modern languages you could indeed make a for loop iterate over a collection of objects but foreach is syntactical sugar to make things more readable and simplier.
It'd be just as funny on Jow Forums desu
>javashit
a foreach on a Set returns elements in no particular order (unless this set is an instance of some class that provides a guarantee)
>docs.oracle.com
foreach isn't always in the same order. for is. (emphasis on always. It usually is)
That's the main difference.
>O(n) useless iterations
Use a map and sum values you mentally retarded wh*Te
It scales poorly. Don't use bad form, you're gonna hate yourself in a year when you have to unlearn it.
it's sugar coating shit. people who use filter functions tend to iterate over the data multiple times instead of moving all conditions into one function. so it's better readability, arguable, at the expense of performance. #onlyJSstuff #$oyLatte
youre an idiot, dont put yourself at risk
I actually NEVER use brackets if I don't have to.
I find it makes code far easier to read.
If you come across people that are blind to lines like those, and want you to use brackets, tell them to learn python.
That code is fucking trash
>all these Jow Forumsack programmers coming out of the woodwork
How much do you make and how many pajeets do you have to deal with?
>125k annually
>0
t. Game dev.
>implied brackets are easier to read than actually writing out the brackets
Nigger why.
Rate my Python:
print 'OP is a fag'
The poos are almost bearable since they all are QA, but the burgers on top of the food chain that think they are elite full stack devs and merge shit without PR's is the thing that annoys me the most, because later i have to fix their autistic code.
Because you don't end up with 900 lines of codes when you need a bunch of random if's for some reason.
10/10
would print again
The only Indian I have ever seen was in University.
And I live and work in Frankfurt.
Your code is shit.
Repeating what has already been said.
1. Use filter
2. use actual types correctly (who the fuck has an array of numbers and other types together)
3. Your function returns VOID / UNIT so it is worthless.
4. Fuck javascript.
t. Staff software engineer in San Francisco who makes $350,000 a year no memes.
Last one that was said before:
Don't use var.
>350k
You hiring?
>t. Staff software engineer in San Francisco who makes $350,000 a year no memes.
I only make 50k a year in Germany. This is some bullshit.
Awful, as I'd expect from a reactionary Jow Forumstard.
Post yfw programming was invented by a fag.
[code]
function discriminate(arr) {
return arr.fuckilter(elm [fuck you don't steal my code for homework newfag] typeof elm == 'number');
}
[/code]
>for each loops in Javascript
Enjoy your lack of cross-platform support, 16 year old.
Suck dicks until you become Alan-tier.
You do any modeling ?
heterogeneous lists are gay
Pretty much this. Use immutable variables for near 100% of your code.
OP if you were using a real language like Scala first of all this shit wouldn't even compile because you would be dumb enough to mix numbers and non numbers together in an array. But assuming you had
val userInput: Seq[String]
You would write something like
val numbers: Seq[Int] = userInput.flatmap(parseInt)
What is this, code golf? I'd rather have 900 lines of code written as 900 lines of code than have it compressed into 200 lines of illegible code.
Nah.
I can do it, but I'm waaaay to slow to do it professionally.
I mainly do AI & Networking. Sometimes Physics.
This is the dumbest thing I have read in this whole thread.
>Hur dur I'm too retarded to understand that the one single indented line below an if() is the only line that's executed.
Take a course in python.
>not using ES6
Let's start a flamewar
To all anons:
Tabs or spaces?
Tabs.
Is it possible to do a full game by yourself over the span of 5 years ?
>javascript
>newArr
copy paste code, actual nigger
2 spaces
You can program yourself sudoku in one weekend, it depends on what you want to do.
fuck off
Depends on the size & type of game.
Flappy bird? Yes.
Call of Duty? (shitload of MoCap & videos) No.
god damn tabfags can eat a bag of dicks.
>if(typeof(arr[i]) === 'number')
This line.... holy shit
Holy shit JavaScript is cancer on wheels
How did it ever get popular
Yeah lets use 2 spaces when there is even a dedicated button for a tab RETARD.
An open world RPG ?
>the keyboard has a key i guess that means i have to use it
i bet you use scroll lock too, you testicle-shitting rectal wart.
Lolwut. Don't be an autist you'll get suspended
I think it's a joke.
why is it called var and not enum?
Yes, JavaScript is a joke.
Sadly, it has become popular regardless.
>2018
>using a mouse
Get a load of this twat
>not using ES6
it is the CURRENT YEAR
Anyone else have zero idea how code works? I'm guessing you have to be some kind of high functioning autist to understand code.
I'd love to know how to code but shit is like Chinese to me. I wish they taught this shit in school when I was younger.
2 spaces master race
>implying I can read that
jokes aside, does scroll lock mean something different in germanistan?
here in the empire of burgers, it's a useless key on the keyboard.
It's not that one single indented line below an if() is the only line that's executed. Everyone knows that. It's that it makes it harder to read when you have a large stack of conditionals and the programmer swaps constantly between no-brackets and brackets because, guess what, no-brackets only works with one trailing line of code. Not using brackets on statements like that also makes it a lot easier for someone to screw it all up when they're trying to maintain your code later. Plus, it just looks a lot cleaner. It's about consistency and cleanliness, not what looks slick and saves a line or two of code.
I started by creating Pong in XNA, user..
Might even have a tut I wrote for a buddy of mine somewhere.. Gimme a sec
CS101/10.
Why does it seem like young people in school learn nothing but js, html and python? The only one you might have a shot with a decent pay is python but you need java/c# to really get somewhere
>be jap
>use ruby
>dare to teach anybody
Please.