Category: tutorials
-
JavaScript Tutorial Series – Arrays
In JavaScript, arrays store a list of items. An item may be a primitive such as a string or number. An item may also be an object or another array. Indexing starts at 0. Arrays are objects. To determine if a variable is an array, use Object.prototype.toString.call(theArray) === ‘[object Array]’ or the newer way of…
-
JavaScript Tutorial Series – Variables
In JavaScript, variable names must start with a letter or underscore, are case sensitive and multiple words should be camel cased, example: aVariableName. Variable names may only contain letters, numbers and underscores. JavaScript determines what type a variable is. There are primitive and complex types. Valid primitive types include string, number, boolean, null, symbol and…
-
JavaScript Tutorial Series – Style Guide
A best practice in programming is to adhere to a consistent style guide. It allows for more readable code and easier maintenance. All code looks uniform even when multiple people contribute to it. JavaScript doesn’t have one set standard style guide. There are a couple of different style guide options though. These are provided by…
-
JavaScript Tutorial Series – Comments
Comments are used to make notes in source code about what a piece of code does or to not include executable lines of code when the application is run. Comments are not rendered on the page when the containing JavaScript file is loaded. Comments are created in JavaScript by adding 2 forward slashes, //, in…
-
JavaScript Tutorial Series – IDE
JavaScript source files end in .js. JavaScript source files can be written in a simple text editor. IDE’s will offer a better experience though as they have features such as code completion, a debugger, error highlighting and source code formatting. I use NetBeans or Visual Studio Code. Other options include Eclipse, Atom, Komodo and Brackets.…
-
JavaScript Tutorial Series – Set Up
JavaScript runs in a web browser, so all that is needed to get started is having a web browser, such as Google Chrome, Firefox or Internet Explorer, etc. installed on your computer. That’s it. Super simple. Implementation: The goal of this JavaScript Tutorial series is to teach JavaScript to someone with programming knowledge. This tutorial…
-
Python Tutorial Series – Packages
Python modules can be organized into packages. A package is a namespace which contains a set of modules. Packages are useful for organizing modules, especially when an application is large and contains a lot of modules. To create a package, create a directory and add python files to it. The directory must contain an __init__.py…
-
Python Tutorial Series – Classes
In object oriented programming, classes are used as a blueprint to define objects in an application. Classes are a way to organize code, provide the ability to easily extend functionality and allow for reuse. In Python, a class is defined as follows: class BaseClass: # constructor def __init__(self, param1): self.param1 =…
-
Python Tutorial Series – Modules
A Python module is composed of the classes, functions and variables contained in a single python file. A python file can contain multiple classes, not just a single class like in Java. Module names should be simple and ideally kept to one word. Below is an example module, which is contained in a file called…
-
Python Tutorial Series – Files
In Python, files are opened with the open command. The open command takes two parameters. The first parameter is the file name. The second parameter is the mode to open the file in: r – Open the file for reading. An error is thrown if the file does not exist. a – Open the file…