Var car;

var car;
console.log(car); //undefined


>not null
>javascript

Attached: justfeel.png (312x390, 43K)

@67172084
did you just?

edit: this blew up guys!

cringe

>Doesn't define what the car variable should store
>car yields undefined
>this confuses the brainlet

cringe

>car yields string undefined
ftfy

This is expected functionality and is actually good

>he doesn't understand the difference between null and undefined

it doesn't even have a type

>he expects a computer to give data an initial type and value
Are you a fucking idiot? Are you the kind of person who actually enjoys using languages which hold your hand that much?

>he expects the language to give an initial value to something which has yet to be typed

the absolute state of Jow Forums

How could it be null, autist? If you wanna hate on JS, cool, at least make a valid point.

>not null
There is no reason it should be null. Just like in C if you do something that dumb and make use of the variable you have undefined behavior and should be treated like a retard for thinking it zeros everything for you.

>javascript
>var types
KYS

1 == "1"
>true
1 + "1"
>11


huh...so this is the power of web devs

Attached: 1533689307358.png (376x341, 57K)

[1,3,10,4,9].sort()
> [1, 10, 3, 4, 9]


wow javascript.... just wow.

>it's actually true
WTF

>doesn't understand casting

you should learn your language before you write bad code.

actually....

Attached: Screenshot from 2018-08-17 00-52-13.png (414x282, 27K)

Just int() or toString() before adding shit together from different types

Attached: vivaldi_2018-08-16_19-54-16.png (325x42, 3K)

It should still recognize niggers desu...

desu

~$ nodejs
> [1,3,10,4,9].sort()
[ 1, 10, 3, 4, 9 ]
>

Oh my god. How is this actually possible. My hardcoded hacked together bubble sort that I wrote at 3AM works better than this.

dealing with undetermined types...

>double equals

Spotted the retard

>type casting in javascript

Attached: watsonlol.jpg (1118x1207, 118K)

>==
not using
>===

the absolute state

function() {
for(var i = 0; i < 10; i++) {
var foo = "hello";
}
console.log(foo);
}();

> hello


so this is what a language coded in 10 days looks like. amazing

>declaring vars in loops
user...

>muh meme syntax
KYS hipster

it's better, especially for lambda function type situations. what he should have written is this though

[1, 3, 10, 4, 9].sort((a, b) => a > b);
>[1, 3, 4, 9, 10]

Fuck off with your shitty hipster syntax.

[1, 3, 10, 4, 9].sort(function(a, b){return a > b;})
>(5) [1, 3, 4, 9, 10]

>language has shitty """features"""
>You're doing it wrong!
lmao, okay Steve Jobs

>shitting on arrow functions
How to spot a brainlet: 101

Attached: 1519950886004.png (469x452, 277K)

Wow good thing the function keyword is there, otherwise I wouldn't have known it was a function.

I was like you once. You'll come around.

>implying thats a bad thing
how else are you supposed to have temporary values that live within the scope...

>polluting the namespace

>doesn't understand syntax for one of the easiest to learn languages on the planet
>blames the language for his shortcomings

Attached: 1443893323541.jpg (460x230, 34K)

>muh functional brogramming paradigm
learn a real language if you want to play with the cool guys

I bet you use "each"

You can't actually defend your argument, if you can call it that.

var faggot;
for(var i = 0; i < 10; i++){
faggot = '(You)';
}

>not using let
It's not 2011 anymore user.

Attached: 20180816_195812.jpg (1080x857, 107K)

>b-b-but muhh casting!
I don't cast anything because I am not a wizard like you

>using let at the top of the function block
top jej

>Wow good thing the function keyword is there, otherwise I wouldn't have known it was a function
Makes it 100% more readable

Get with the times, grandpa. Shorter syntax = better

You're going to have to explain how
let arr = [1,2,3,4,5,6,7,8,9,10]

arr.reduce(function (a, v) {
return a + v;
});


Is more readable than:
let arr = [1,2,3,4,5,6,7,8,9,10]

arr.reduce((a, v) => a + v);

lmao okay lets just declare all variables globally then.
fucking brainlet

What text editor is this?

that explains while all the sorting in google drive is fucked

Don't listen to the boomer he thinks the arrows points to his closest homesexuality

>I don't understand the performance drawback of using var or let in a loop
fucking brainlets

>using reduce
omg fucking hipster useless shit

>performance
>javascript

If I cared about performance so much I would be using c++ and wasm. Front end stuff does not need to be "super le optimised bro hehehe". I want my code to be readable and maintainable.

Oh yeah, look at those precious milliseconds I'm losing

Attached: 20180816_204022.jpg (1080x1341, 310K)

>simple increment
try harder, code nigger, like a class instance

>I code to look at pretty code
>I don't care about the end user the code is for
the absolute state

No shit if I have to instantiate a new class instance every single loop the performance would be bad. That's not what we're talking about, is it though retard?

You only use loops to increment?

there's worse ones.
"2"+2 == 4
True
"2"+null == 2
False
"2"+null
"2null"

welcome to programming brought to you by fisher price

What are you even talking about? The post I replied to was talking about using var and let inside of for loops and the performance hit incurred from doing it.

I get 22 for "2"+2

oh it's perfectly fine then

Attached: Gene_Wilder_as_Willy_Wonka.jpg (335x297, 15K)

same lel
"2"+2 == 22
but
"2" * 2 == 4

And i'm saying try to declare class instances like you do in video games and you'll see how bad it slows down!
>muh += operation
>muh low impact
fucking brainlets

>create a language where 1 + 5 == 2
>document it
>well my language isn't shit, you just didn't read the docs?
how about we document your stupidity so you blame others for not understanding you

>1+5 == 2
what did he mean by this?

Attached: Screen Shot 2018-08-17 at 01.56.36.png (244x116, 8K)

Holy fuck you mongoloid I say so myself right here! If this was bait then consider myself got. I'm not replying again.

that's weird

Attached: ShareX_2018-08-16_21-57-58.png (103x43, 832)

>x == "x" is the same as x = x

Attached: .png (1200x1335, 298K)

Not willing to use a for loop at this point, they're too ugly

>i was only pretending to be dumb earlier
>I totally agree with you in fact
fucking piece of shit

>jump of a roof
>"LIFE HAS SHITTY FEATURES!!!!!!"

>> -5 >> 3.14596

Attached: haram.jpg (525x380, 27K)

>you're holding it wrong
how much does google pay you

>javascript
>namespace
you seem confused, user

Just because js doesn't have a way to define private namespaces doesn't mean the global one doens't exist.

even dynamically typed languages have types. You've never initialized it. It's literally undefined.

>JavaScript is the only language with loops
you heard it here first lads

>has namespaces like only one and it it it's global
LMAO this is getting better and better

you are confused, user

namespace = (function() {

})();

There. A javascript namespace. Now that wasn't so hard, was it?

Sure, show me how you switch from one to the other and specifically use a class instance declared in one or the other namespace, from the global "namespace"

namespace = ( () => {
Fuck u
}

>WHY VARIABLE UNDEFINED AFTER I NO DEFINE IT

You are absolutely wrong.

During the compilation stage, all variable declarations become initialized to undefined, and are then attached to their surrounding scope. This all happens before a single line of JS is executed. So if you are using var within a for loop, there is literally no difference execution-wise to declaring it outside the for loop. And using let outside of a for loop- well, that defeats the entire purpose of let now doesn't it?

Different user. what is benefit of let over var?

No one in the thread is saying that. You're just retarded.

is saying it should be null not undefined

let is blocked-scoped whereas var is function-scoped. So for example if you use let inside a for loop, you will not be able to refer to it outside the for loop, which is how most programmers expect loops to work. This is not true for var.

Only the first one is a problem. The second one is logical.

What do you mean switch from one namespace to another? If you want to use a different namespace, just refer to it by its variable name. Namespaces are just values, after all- this is true of both Javascript and Node. And whatever you return from the namespace becomes the public API. It's easy to make an internal class accessible, just return it.
var namespace1 = (function() {
function HelloClass() {

}
return {
hello: function() { console.log("Hello"); },
HelloClass: HelloClass
};
})();

var namespace2 = (function() {
var msg = "goodbye";
return {
goodbye: function() { console.log(msg); }
};
})();

// in a separate file, the "global" namespace
namespace1.hello();
namespace2.goodbye();

var helloInstance = new namespace1.HelloClass();

You're wrong, he's right. The second one is harder to read because you're doing multiple different things on 1 line.

>if there are less characters, its more readable
holy shit what a college freshman-tier opinion

I agree user, that's why I write my for loops like this otherwise it's too confusing
for (
var i = 0;
i < 10;
i++
) {
console.log(i+1);
}

t. retard

what are you, a college sophomore?

arr.reduce((a, v) =>
a + v);

oh fucking come on with those tags

If you seriously cannot understand the difference between readability and verbosity, then you don't belong in this industry. Please switch majors. We don't need any more retards writing clever code.

Attached: 230114_908223010.jpg (600x524, 34K)