Comments
Line (`//`) and block (`/* */`) comments use the exact same syntax across all five languages — the only difference is doc-comment convention.
- Node.js
- Go
- Rust
- Swift
- Java
const you = new NodeDeveloper();
Each post takes a familiar JavaScript concept and sets it next to the equivalent code in other languages. Pick a language in any code block and the whole page follows.
Line (`//`) and block (`/* */`) comments use the exact same syntax across all five languages — the only difference is doc-comment convention.
How Node.js's console.log/console.error map to Go's fmt.Println/Printf, Rust's println!/eprint!, Swift's print, and Java 25's IO.println.
How ad-hoc timestamped console.log in Node.js compares to Go's log/log-slog, Rust's tracing crate, Swift's Foundation, and Java's System.Logger.
What const and let in Node.js correspond to in Go, Rust, Swift, and Java.
How JavaScript's template literals (`${}`) compare to Go's fmt.Sprintf, Rust's format!/println!, Swift's string interpolation, and Java's String.formatted.
How JavaScript's primitive and composite types compare to Go's, Rust's, Swift's, and Java's static type systems (int8..uint64, struct, map, channel…).
How JavaScript's typeof/Object.prototype.toString compare to Go's reflect.TypeOf, Swift's type(of:), Java's getClass(), and Rust's std::any::type_name.
How JavaScript's BigInt compares to Go's math/big, Java's java.math.BigInteger, and Rust's num-bigint crate — Swift has no built-in big-number type.
How Node.js's WeakRef and FinalizationRegistry compare to Go 1.24's weak.Pointer and runtime.AddCleanup: holding a reference without blocking GC, cleaning up after an object is reclaimed, and a cache that releases memory on its own.
How JavaScript's if/else if/else and ternary operator compare to Go (no ternary), Rust (if is an expression), and Swift/Java (both have a ternary).
How JavaScript's C-style for loop compares to Go (C-style + range-over-int since 1.22), Java (keeps C-style), and Rust/Swift (no C-style for, only range).
How JavaScript's while loop maps to Go's for used as a while loop (Go has no while keyword) — Rust, Swift, and Java all have while like JavaScript.
How JavaScript's switch/case compares to Go (no fallthrough by default, explicit fallthrough), Rust's match (no fallthrough concept), Swift (like Go), and Java (like JS).
Node.js's slice and concat compared to Go's slice, Rust's Vec, Swift's value-type Array, and Java's ArrayList.
Node.js's forEach, map, filter, reduce compared to Rust, Swift, and Java iterators, and hand-written generic Map/Filter/Reduce functions in Go.
Node.js's Array.prototype.toSorted compared to in-place sorting in Go, Rust, and Java, and Swift's sort()/sorted().
Node.js's Uint8Array (set, subarray, fill) compared to Go's []uint8, Rust's &[u8], Swift's [UInt8], and Java's byte[].
Node.js's Buffer.alloc, writeUIntBE/LE, and Buffer.compare compared to Go's []byte, Rust's &mut [u8], Swift's [UInt8], and Java's byte[].
Node.js's Map (set/get/has/delete, for...of) compared to Go's map[K]V, Rust's HashMap, Swift's Dictionary, and Java's HashMap.
Node.js object literals and methods compared to structs/classes with separate methods in Go, Rust, Swift, and Java.
How Node.js declares functions and parameter types compared to the explicit function signatures of Go, Rust, Swift, and Java.
First-class functions, closures, and currying in Node.js compared to function values and closures in Go, Rust, Swift, and Java.
Default parameters in Node.js and Swift compared to Option (Rust), overloading (Java), and pointers + nil (Go).
Object destructuring in Node.js compared to struct pattern destructuring in Rust, tuple destructuring in Swift, record patterns in Java, and multiple assignment in Go.
Node.js's spread and rest operators compared to real variadic parameters in Swift and Java, slice destructuring in Rust, and `...T` in Go.
Swapping two variables with array destructuring in Node.js compared to destructuring assignment in Rust, the `swap` function in Swift, multiple assignment in Go, and a temporary variable in Java.
IIFEs in Node.js compared to immediately invoked anonymous functions/closures in Go, Rust, Swift, and Java.
Generator functions and iterator helpers in Node.js compared to Iterator (Rust), AsyncStream (Swift), virtual threads (Java), and `iter.Seq`/channels in Go.
Classes, private fields, and inheritance in Node.js compared to real classes in Swift/Java, structs + traits in Rust, and structs + embedding in Go.
Node.js's EventEmitter compared to NotificationCenter (Swift), a hand-rolled callback map (Rust, Java), and channels with select in Go.
How Node.js's Promise .then()/.catch() and Promise.all() compare to channels (Go), Future (Rust), async/await (Swift), and CompletableFuture (Java).
How Node.js's Promise and async/await compare to goroutines (Go), Future + tokio (Rust), Swift concurrency, and CompletableFuture (Java).
How Node.js's setTimeout and setInterval compare to time.AfterFunc/Ticker (Go), std::thread (Rust), Task.sleep (Swift), and ScheduledExecutorService (Java).
How Node.js's Readable/Writable/Transform streams compare to io.Reader/Writer (Go), std::io::Read/Write (Rust), Pipe (Swift), and InputStream (Java).
How Node.js's worker_threads/child_process.fork() compare to goroutines (Go), std::thread (Rust), TaskGroup (Swift), and thread/ProcessBuilder (Java).
How Node.js's MessageChannel compares to channels (Go), mpsc (Rust), AsyncStream (Swift), and BlockingQueue (Java) for sending data between tasks.
How Node.js's AbortController/AbortSignal compares to Go's context.Context: cancelling manually, timeouts, combining cancellation signals, and checking for cancellation inside a loop.
How Node.js's Promise.all/allSettled/any combined with AbortController compare to Go's errgroup, sync.WaitGroup, and channels: cancelling sibling tasks when one fails, limiting concurrency, collecting every result, and taking the fastest one.
How Node.js's AsyncLocalStorage carries a request ID along the async chain on its own, compared to Go's context.Context, which you pass explicitly through every function.
How Node.js's throw and try/catch/finally compare to error values in Go, Result in Rust, throws in Swift, and exceptions in Java.
How Node.js's process.on('uncaughtException') compares to panic/recover (Go), catch_unwind (Rust), do/catch (Swift), and an uncaught exception handler (Java).
How Node.js's console.trace() compares to debug.Stack() (Go), Backtrace (Rust), callStackSymbols (Swift), and printStackTrace() (Java).
How Node.js's using/await using, Symbol.dispose, and DisposableStack compare to Go's defer: block vs function scope, LIFO order, and errors during cleanup.
How Node.js's readFile/writeFile compares to os.ReadFile/os.WriteFile (Go), std::fs (Rust), FileManager (Swift), and java.nio.file.Files (Java).
How Node.js's process.stdout.write/process.stderr.write compares to fmt.Fprint (Go), io::Write (Rust), FileHandle (Swift), and System.out/err.write (Java).
How Node.js's readline/promises compares to bufio.Reader (Go), io::stdin (Rust), readLine() (Swift), and IO.readln (Java) for reading a line of input.
How Node.js's process.argv/util.parseArgs compares to os.Args/flag (Go), env::args (Rust), CommandLine (Swift), and main's parameter (Java).
How Node.js's process.env compares to os.Getenv (Go), env::var (Rust), ProcessInfo.environment (Swift), and System.getenv (Java).
How Node.js's child_process.execSync/exec compares to os/exec (Go), std::process::Command (Rust), Process (Swift), and ProcessBuilder (Java).
How Node.js's net.createServer compares to net.Listen (Go), TcpListener (Rust), Network.framework (Swift), and ServerSocket (Java) for a TCP echo server.
How Node.js's dgram.createSocket compares to net.ListenUDP (Go), UdpSocket (Rust), Network.framework (Swift), and DatagramSocket (Java) for receiving datagrams.
How Node.js's http.createServer compares to ServeMux (Go 1.22+), axum (Rust), Network.framework (Swift), and HttpServer (Java) for a routed HTTP server.
How Node.js's global fetch() compares to Go's net/http: GET and reading JSON, POST with headers, 4xx/5xx status codes, timeouts, and streaming the body.
How Node.js's node:dns/promises compares to the net package (Go), hickory-resolver (Rust), getaddrinfo (Swift, A/AAAA only), and JNDI (Java) for DNS lookups.
Node.js's Date and Intl.DateTimeFormat compared to Go's immutable time.Time, Rust's chrono, Swift's Date, and Java's java.time: parsing, adding days, and formatting.
Node.js's RegExp literals compared to Go's regexp, Rust's regex, Swift's Regex literals, and Java's java.util.regex: replace, test, and find all matches.
Node.js's JSON.parse/stringify compared to Go's encoding/json, Rust's serde_json, Swift's Codable, and Java's Jackson for mapping fields.
Node.js's WHATWG URL compared to Go's net/url, Rust's url crate, Swift's URLComponents, and Java's java.net.URI: getting the scheme, user info, port, path, and query.
Node.js's zlib.gzip/unzip (promisified) compared to Go's compress/gzip, Rust's flate2, Swift's zlib via C interop, and Java's java.util.zip.
Node.js's createHash compared to Go's crypto/sha256, Rust's sha2, Swift's CryptoKit, and Java's MessageDigest for computing a SHA-256 hash.
Node.js's node:sqlite compared to Go's go-sqlite3, Rust's rusqlite, Swift's SQLite3, and Java's sqlite-jdbc: creating a table, inserting, and querying.
Node.js's npm compared to Go modules, Cargo (Rust), Swift Package Manager, and Maven/Gradle (Java): installing, updating, removing, and exporting/importing packages.
Node.js's node:test + node:assert compared to Go's testing, Rust's #[test], Swift Testing, and Java's JUnit for table-driven tests.
Node.js's tinybench compared to Go's testing.B, Rust's criterion, Swift's ContinuousClock, and Java's JMH for measuring function performance.
Node.js's JSDoc compared to Go's doc comments, Rust's rustdoc, Swift's DocC, and Java's Javadoc, plus examples that run as tests.
Build a dynamic array on top of fixed storage in Node.js, Go and Rust: length, capacity, doubling when full, push/pop/insert/remove and their complexity.