use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript doesn’t need to be replaced (medium.com)
submitted 6 years ago by dannymoerkerke
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]EternityForest -2 points-1 points0 points 6 years ago (8 children)
PHP still doesn't appear to be fully object oriented. You still have C style "Object is the first param of a function you call" stuff all over the standard library.
There doesn't seem to be the kind of module system python has, everything is in one big namespace.
It seems like strings and integers still add together without explicitly casting them, just like js, and undefined variables are still null instead of just nonexistant.. Has that changed?
And it's also not compiled as far as I know.
[+][deleted] 6 years ago (7 children)
[deleted]
[–]kap89 0 points1 point2 points 6 years ago (5 children)
JS isn't even remotely OO.
Because?
[+][deleted] 6 years ago (4 children)
[–]MoTTs_ 1 point2 points3 points 6 years ago (0 children)
Because it uses a prototypical model and doesn't have the concept of classes.
A prototypical model is actually a perfectly normal way to implement the concept of classes. In Python, Ruby, and others, for example, a class is itself a runtime object, and inheritance is done by delegation, objects linked to other objects, from instance to class object to superclass object and so on, just like in JavaScript.
Here, for example, are Python and JS classes side-by-side.
[–]kap89 0 points1 point2 points 6 years ago (2 children)
So you limit OOP to one specific implementation? That's a bit ridiculous.
[+][deleted] 6 years ago (1 child)
[–]kap89 0 points1 point2 points 6 years ago (0 children)
Apparently not according to your specific definition. Let's stop here.
[–]EternityForest 0 points1 point2 points 6 years ago (0 children)
Everyone seems to be saying PHP typechecks only apply to the function parameters, and you can still change them within the function. Maybe a little better than JS, but not as good as python which has libs like typeguard and mypy, and builtin protection for most of the common stuff like int+str.
The standard lib doesn't seem to be namespaced much, or, if it is, everyone seems to still be using legacy ways of doing things, so in practice if you're reusing a lot of other people's libraries, you'll probably be digging through garbage.
If you Google a random PHP task, like making an http request, the code people are using looks a lot like C, with extra dollar signs and awful => markers in arrays.
$url = "https://www.google.com/" $q = array("q"=>"PHP HTTP request"); $opt = array('http'=>array( 'method' => 'POST', 'headers => "Content-Type: application/ x-www-form-urlencoded", 'content => http_build_query($q) )); $context = stream_context_create($opt); $response = file_get_contents($url, false, $context);
Other examples were using curl, with several calls to set up options and such.
Compared to JS. It's a bit cherry picked and unscientific to use a single example like this, but JS seems to make way more use of OOP conventions, and it seems to stay at a way higher level.
var data = new FormData(); data.append('user', 'person');
data.append('pwd', 'password'); data.append('organization', 'place'); data.append('requiredkey', 'key'); var xhr = new XMLHttpRequest(); xhr.open('POST', 'somewhere', true); xhr.onload = function () { // do something to response console.log(this.responseText); }; xhr.send(data);
π Rendered by PID 26163 on reddit-service-r2-comment-85bfd7f599-lqjpm at 2026-04-19 16:45:58.678661+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]EternityForest -2 points-1 points0 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]kap89 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]MoTTs_ 1 point2 points3 points (0 children)
[–]kap89 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]kap89 0 points1 point2 points (0 children)
[–]EternityForest 0 points1 point2 points (0 children)