Sup Forums inspirational thread

Post 'em.

kys

What the fuck does "be awesome" mean?
If you're sad for whatever reason, you can't just turn off emotion, you stupid shit.

it's a
>just beeee urself
in "nerd" language

gay as fuck desu famalam.

every day, I look at my desktop and get inspired

Cringe

>function().function()
really makes you think

...

This picture can fuck right off. OP, are you 12 years old? No self respecting human being over the age of 12 would save this on their computer.

Javascript is so shit you need a TYPE COERCIVE EQUALITY OPERATOR.
Also what the fuck kind of object is also a function?

>computer
:^)

>beawesome()
>while writing in javascript

webdevs have no self-awareness

i don't think boolean true has a method called stop

...

...

...

>you can't just turn off emotion

You can.

This user is correct, just kys that turns off all emotion :^)

Is that Perl?

if(!isPooInLoo){
getLoo();
pooInLoo();
}

>===
?

I mean, chaining functions is nothing extraordinary, you're calling the second function on the return value of the first function. Except we've already established that the return value of sad() is true, so we're calling true.stop()
So the core message of this picture is that sad people should flee the truths that are too painful for them to bear and find refuge in a comforting lie. Really makes you think.

>sad is a function
>we don't know if it returns anything
>calling a function on a function call
>calling a function on a Boolean instead of setting it to false
Who else but jsdevs

>camelCase
Yuck.

go back to facebook faggot

I can only compile lisp please rewrite it

Or maybe sad() returns an object and === operator is overloaded so it will work with booleans?

In all languages I've seen it in, === is the identity operator. That would mean the return value of sad isn't just truthy, it actually is the boolean true.

>he doesn't know about data abstraction

How can sad() return true and then return an object that has a stop function? I would by this shirt if it was

if (self.sad?() === true) {
self.emotion = happy;
self.beAwesome();
}

simple minded.

if (sad.toBoolean()) {

ftfy

It's bait you nigger-level-IQ faggot

sad() returns an object that can be casted to bool

sad() has a side effect where on even even calls it returns a boolean and on odd calls it returns an object.

Yes but you can still add it to true's prototype.

Sup Forums-chan daisuki

lmaoing@your life
>untyped language
no wonder JS programmers are sad

likely javascript equal operator
compares type and value so sad() returns a boolean true, instead of any other 'true' value, int 1 for example

>===

fuck off with your pleb language

For all intents and purposes, your phone is a computer. Also your psp, your ipod and whatever. Even if you've grabbed an Ethernet cable and are using it to communicate with the Sup Forums servers, your brain is a computer and you saved the image by memorizing it

>you can't just turn off emotion
step up senpai

[/code]
#include
int main(void)
{
printf("epic post op!! upvoted.\n");
return 0;
}
[/code]

>>>/reddit/

LOL

lol where did you guys find this im laughing my ass off XD.

At least this follows the noun.verb() bullshit you're supposed to be following in OOP

>2017
>Using if statements

What if your boss isn't called Nearby?

go back to plebbit

fuck off with your if statements imperative scum

That isn't even proper pseudocode
Fuck off you webdev scum

=== matches type, so sad() would HAVE to return a boolean.
But it's irrelevant, because any truthy result would satisfy the conditional so having == true is unnecessary.

cool dobs op
import human;
// import physical_utilities.items.weapons;
Human me = get_current();
if(me is null)
return;
else {
me.brain.Emotion sad_emotion = me.brain.emotions.get_node_by_tag("sadness");
if(sad_emotion.value > sad_emotion.THRESHOLD_KS)
sad_emotion.value = sad_emotion.value - sad_emotion.time_delta;
else {
me.brain.Action ks_action = me.brain.motive.get_node_by_tag("KS");
ks_action.initialize;
while(!ks_action.ready){
// err: access violation here for some reason
writefln("time %d id %d", current_time, me.id);
ks_action.update;
yield;
}
ks_action.execute;
me.valid = false;
destroy(me);
return;
}
}

>Boolean getter method is not prefixed with get or is
>Some shitty scripting language where == d
>Comparing to true
>Member function of a boolean ???


>No newline before curly brace

sauce?

are you supposed to use === for everything? what is the point of ==?

So you can do stupid shit like this.
"0.0" == false

You can tell this was written by a fucking woman.

>method
It's a simple if statement, you colossal sperg.

JavaScript is trwtf, but even in that lovecraftian language shit like this isn't logical code. Ether the condition isn't satisfied, or evaluation of sad().stop(); results in a type error (sad.stop is not a function).

You can never be awesome. There's some reality for ya.

That doesn't work in JavaScript.
However, you can actually make the code valid by adding a stop function to the prototype of the boolean constructor.

Boolean.prototype.stop = function() { console.log("Stop called!") };
var a = false;
a.stop();
//Stop called!

To further elaborate on this and to BTFO the fizzbuzz armchair programmers on this board who will never be able to get a programming job, here:

function beAwesome() {
console.log("BeAwesome Called");
}

var _sad = true;

function sad() {
return _sad;
}


window.Boolean.prototype.stop = function() {
_sad = false;
};

// The actual code
if (sad() === true) {
sad().stop();
beAwesome();
}


That runs. Fuck you. Learn JavaScript before you make ridiculous claims like "it doesn't run".
But don't get me wrong, this code is still stupid as fuck.

Goddamn I hate Javascript.

Why? What about this code is unclear?

It's clear that it does work, and it's clear how it works. I just hate that it does.

As much as it can be, anyway. I still don't
really understand how prototypal inheritance works.

...

Anyone else get triggered by pseudocode?
It's just so dumb and not funny.

Pseudocode is fine.
Pseudocode masquerading as code like OP is just retarded and I hate it.

Prototypical inheritance isn't nearly as hard as people think it is. Maybe I can help you a little.

Let's just say you have this object:
var a = {
prop: 'Hi!',
otherProp: 'sup!'
};


Now, when you do a.prop or a.otherprop, you can access its members.
What if we say a.thirdProp? That doesn't exist on a, so we get undefined.

Now let's add prototypes into the mix.

Every object has a special property called __proto__. Let's create another object and assign it as a's __proto__:

var b = {
thirdProp = 'Hi again!'
}

a.__proto__ = b;


And let's call a.thirdProp again. Instead of getting undefined, we actually get 'Hi again!' this time.
What happened? Well, when we did a.thirdProp, the code first checked if a has this member. It doesn't. But instead of returning undefined here, it went to look at a's __proto__. Does its __proto__, which we set to be b have the property thirdProp? Yes it has. So that's what it returned.

If a had a property called thirdProp by itself, the prototype wouldn't have been looked at and the property value from a would be returned. If b didn't have a thirdProp, then the engine would have looked at b's prototype and, then at b's prototype's prototype and so on until one of the objects in this so-called "prototype chain" has no __proto__.
things like a.ToString() or a.valueOf() for example, also come from this prototype chain. Unless you explicitly say not to, all objects have an "Object" instance as their prototype, which has these properties.

So in essence, it's simple. "Does my object have the requested property? If no, ask its __proto__. Otherwise, ask __proto__ of its __proto__. Keep going until one of the __proto__s has the property or until we have no more __proto__ in the chain.

I already knew that much, yeah. Your prototype is just another object and it works pretty much like a superclass.

But then you introduce the new keyword and these pseudo-constructors and I'm lost all over again.

Yeah.The confusing part of this is that there is __proto__ and prototype. JS developers refer to both as "Prototype", even though they are really different.

Basically, Functions in JavaScript are somewhat special. Like all objects, they have a __proto__, which is the function object which gives your functions methods like call, bind, name etc.

But all functions also have a property called prototype, which is separate from __proto__. By default, a function's prototype property is (almost) an empty object.
This prototype object doesn't change the behavior of the function itself in any way. It only gets used when you use the "new" operator. The new operator can be used on any function to produce an object that is an instance of this function, for example:

var fun = function() {};
var funOb = new fun();
funOb instanceof fun; // returns true.


When we call new, the function gets executed with the variable "this" being set to the new objects that's getting constructed. For example, we can add properties to it here.
var fun = function() {
this.someProperty = 'Hello!';
};
var funOb = new fun();
funOb.someProperty; // Returns 'Hello!'


Guess that's not that weird until now.
What may be weird to you is that funOb has a __proto__. Not just the default Object, but... fun.prototype.

That means that when we add a property to fun.prototype, we add the property to the __proto__ of any instance of fun we create.

So for example, when we do
fun.prototype.doSomething = function() {
console.log("Doing Something!");
};

, we can do
funObj.doSomething();
.

The normal prototype chain shit happens then. funObj checks if it has a property called doSomething. it doesn't. So it checks its __proto__. Its proto is fun.prototype. fun.prototype DOES have the property doSomething, we just added it. So that gets returned (and is then called).

Hope this is understandable.

Thanks for bearing with me. This is very confusing stuff.

And that's pretty much how the code I made earlier with the window.Boolean.stop work.

When you create a boolean, even though you don't use new, it works the same. There is a function on the window object called Boolean. Because it is a function, it has a property called prototype.
So when a bool is created, the booleans __proto__ is automatically set to window.Boolean.protoype. You can actually confirm this if you do
true.__proto__ === window.Boolean.prototype; //true


So when I defined window.Boolean.prototype.stop, any boolean could use that "method" now, because it's in its __proto__.

Yeah. It is. The naming really sucks and that's the biggest problem if you ask me.

that's very inspirational

>Hey man I added a stop() method to booleans.
>Cool what does it do
>Is makes the booleans stop hitting me.

>implying you can just stop being sad

Yeah tell that to all the depressed people.

I-I want to look cute like that...

:thinking:

HTML IS NOT A PROGRAMMING LANGUAGE!!!

If should be something like this

if (Boss.getLocationMath

>writing code on phone
> [>_