Which Is The Best?

Ruby was made by someone tired of losing code golf challenges so they made Ruby so they could win :wink:

1 Like

Exactly, lol :rofl::rofl: but I think it was also one with a 30 second time-limit, ngl

1 Like

TIL Ruby was named because the creator didn’t know whether to name it Coral or Ruby, but chose Ruby because it was the birthstone of one of his colleagues.

1 Like

JavaScript for games is the Minecraft enchantment table script of “game languages”

1 Like

A line of JS in games looks like this

if (this.THIS.ThIs(())["keyed"] == x.XrV.this.data(func{alert("this is not even the weirdest example if JS"); //NOTE: WE NEED TO MAKE IT SLOWER)})) {
alert("refedfjejdjfjdidbddn")
}

source: I made a game ~1 year ago in raw HTML and JS. I haven’t been able to sleep since.

1 Like

Most sane piece of JS code

lol, that’s what happens when you don’t follow good naming conventions. Also I don’t think that should work?

1 Like

JS works in mysterious ways. I’m sure on one person’s computer, it would work, and on another’s somehow delete sys32.

1 Like

lol, but one of the points of JS is that it works almost exactly the same on all devices because the browser takes care of making sure everything works fine. Also not possible for browser JS to access files without a user specifically selecting the file in the first place.

1 Like

That is probably true (I don’t know js), but a big point for python is that even though it requires an insane amount of work and memory, it’s technically possible to do many things possible in js

1 Like

Yeah, same with Java and any other language run via a virtual machine/whatever you call it

1 Like

yeah, thing is that it requires so much work that I sometimes wish I knew JS, but I’m too lazy so XD

1 Like

What requires so much work?

1 Like

oh just literally setting up any type of python server

For JS you can do something like:

// setup express server
const express = require("express");
const app = express();
const server = require("http").createServer(app);

// host a static folder
app.use(express.static(__dirname + "/public"));

// handle a get request to host
app.get("/", function(req, res) {
	res.sendFile(__dirname + "/file.html");
});

// handle a post request to /api
app.post("/api", function(req, res) {
	res.send('{ "message":  "This API does not exist!" }');
});

// handle 404
app.use(function(req, res, next) {
	res.sendFile(__dirname + "/404.html");
});

// start server
server.listen(8080);

What’s Python like?

1 Like

oh, honestly… wait it’s actually not that much harder:

from flask import Flask, render_template, send_file

app = Flask(__name__)

@app.route('/')
def homepage():
    return render_template("index.html")

@app.route('/api')
def get_file():
    return { "message":  "This API does not exist!" }

app.run("0.0.0.0")
1 Like

78tevb

1 Like

Personally, I always prefer to do stuff myself, I avoid libraries at all costs.

1 Like

Me too. I only really use libraries for python, and even then that’s just the basic ones like Random and Colorama. The only other libraries I use are imports from my other .py files to make the program faster.

2 Likes

Why use js when you can use a better language that compiles to js.

2 Likes