Skip to main content

JavaScript

Inheritence in JavaScript with Prototypes

·2 mins
Introduction # This is a short post about inheritence in JavaScript. While you read this post, take a moment to connect with me on LinkedIn. Body # Not until ECMAScript 2015 had class syntax. Before that there was prototype inheritance Suppose there is a function: 1 2 3 4 function FullName() { this.firstName = x; this.lastName = y; } Now when you want to return the fullname, you can either define a function inside the FullName function only, like this;

Beginner's Introduction to Promises in JavaScript

·2 mins
Introduction # Promise is a language feature for asynchronous programming in JavaScript. As JavaScript is single threaded, if you are doing something which waits for I/O, you create a Promise for that task. This task could be waiting for an API call from Twitter for example, or reading a file from a filesystem), and you let it run without getting in the way of normal execution flow.

Sending POST Request in Go with a Body

Introduction # Send a POST request in golang is pretty daunting if you have a post body and you’re coming from a scripting language like JavaScript or Python. Here in Go, schema for JSON needs to be defined beforehand in order to marshal and unmarshal string back and forth to JSON. Simple POST # This marshaling/unmarshalling could be an oneliner if your request body is not nested, or is one level deep, or there is not even a body. Consider this example:

Introduction to WebAssembly with Go

I will start this post with a quote from webassembly.org: WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.— webassembly.org That’s a lot of technical jargon. In very simple terms, Wasm provides a way to run code written in multiple languages on the web at near-native speed. Where multiple languages refers to all these languages.