Skip to content

bigtoga/Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Examples

My code samples and scripts that I use to hopefully save time in the future. Some may be wrong, as they might represent "what I knew at the time"!

Array syntax

JavaScript:

// Basic:
var myArray = [5, 10, 15, 20, 25];

// Nested

var nested = {
    "hello":{
        "english":"hello",
        "french":"bonjour",
        "portuguese":"ola"
    },
    "good day":{...},
    "how are you":{...}
}

// Maps

var nums = [4, 9, 16, 25];
var x = nums.map(Math.sqrt)
document.getElementById("demo").innerHTML = x;

2,3,4,5

Python:

myArray = [5, 10, 15, 20, 25];

Dictionary syntax

JavaScript

// Note: In JavaScript, dict and "object" are interchangeable
// Most people typically refer to these as objects in JS
var myDict = {"Name": "Scott", "State": "TX"};

Python:

# Just plain dictionaries in Python myDict = {"Name": "Scott", "State": "TX"};