Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
// step parameter is optional | |
// if step is not passed in, | |
// and start is less than or equal to end, | |
// then step = 1, else step = -1 | |
function range(start, end, step = start <= end ? 1 : -1) { | |
let result = []; | |
// loop iterates up for positive step values | |
// and iterates down for negative step values | |
for (let i = start; step >= 0 ? i <= end : i >= end; i+=step) { | |
result.push(i); |
function arrayToList(array) { | |
let result = {}; | |
if (Array.isArray(array)) { | |
let currListItem = result; | |
for (let item of array) { | |
let newListItem = { | |
value: item, | |
rest: null | |
}; | |
if (typeof currListItem.rest === 'undefined') { |