This is cheatsheet with some basics of syntax and command in different language

Bash loops

BASH loops for while array
For loop array
                                
#!/bin/bash
LETTERS=('A' 'B' 'C')
for letter in "${LETTERS[@]}"
do
  echo "$letter"
done
#Outputs: "A B C"

                            
For loop range
                                
#!/bin/bash
for i in {1..5}
do
  echo "$i"
done
#Outputs: "1 2 3 4 5"

                            
For loop Associative Array
                                
#!/bin/bash
declare -A myArray
myArray["key1"]="A"
myArray["key2"]="B"
for key in "${!myArray[@]}"; do
    echo "Key: $key, Value: ${myArray[$key]}"
done

                            

Bash variables and functions

BASH variables functions arrays
Simple Env
                                
#!/bin/bash
MYVAR=('A')
echo $MYVAR # Outputs: A

                            
Declare an associative array
                                
#!/bin/bash
declare -A myArray
myArray["key1"]="A"
myArray["key2"]="B"
echo ${myArray["key1"]}  # Outputs: A
echo ${myArray["key2"]}  # Outputs: B

                            

Javascript Variables

JAVASCRIPT variables
Different types of variables
                                
// This is a global variable and can be modified
var a = 'a'

// This is a block local-scoped variable and can't be changed
const b = 'a'

// This is local-scoped variable and can be modified
let c = 'a'

// Example overwriting a var value
var a = 'a'
console.log(a) //Outputs: "a"
a='b'
console.log(b) //Outputs: "b"