EDDYMENS

Last updated 2024-01-03 05:33:38

What Is Vanilla Code?

Definition

Vanilla code is source code [→] that has close to zero dependencies on a framework [→] or library [→].

Vanilla code can also be used to refer to code that can run as is without needing to be transpilled [→].

Example

01: import requests 02: URL = "https://example.com" 03: r = requests.get(URL) 04: print(r.content)

Instead of writing their code to perform the request the author of the Python code above imports the requests module/library which contains pre-written code for making external requests.

01: 02: // Typescript 03: function adder(a: number, b: number) { 04: return a + b; 05: } 06: 07: // Javascript 08: "use strict"; 09: function adder(a, b) { 10: return a + b; 11: }

In this example, we have our code in Typescript [↗] this is later transpilled [→] down to vanilla Javascript [↗].

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"