prisskreative
6/24/2014 - 3:17 PM

Basic programming

Basic programming

// Javascript Strings Basics - information in text
//Create a string and save it into a variable

var name = "Priss";
//Passing an argument to console log
console.log(name);


var name2 = 'Priss';
console.log(name);

//Single quote - double quotes no differences but exceptions

var statement = "Priscilla's laptop";
console.log(statement);

var statement2 = 'Priss "hello"';
console.log(statement2);

// Use Backslach \ before the espace character
var statement3 = 'She said \"Priscilla\'s laptop\"';
console.log(statement3);


-----------------

//Escape Characters

//Escape new line \n
//Escape backslach \\
//Escape tab \t



//Use double backslach \\
var path = "C:\\folder\\myfile.txt";
console.log(path); 


------------------

//Multilines
//New line character \n  - \t insert tab space

var multiline = "This is my line 1\n  This is my line 2\n  This is my line 3";
console.log(multiline);


-----------


//Comparing Strings

// Equal to ===  (strict to)
// Equal to ==    
// Greater than >
// Greater than equal to >=
// Least than <
// Least than equal to <=

var first = "Hello";
var second = "hello";

if (first === second) {
  console.log("The strings are equal");
} else {
  console.log("The strings are different");
}// Different because of the capital H


------


var first = "Hello";
var second = "hello";

if (first.toLowerCase() === second.toLowerCase()) {
  console.log("The strings are equal");
} else {
  console.log("The strings are different");
}// Equal


------


function compare (a, b) {
  console.log(a + " < " + b , a < b);
}

compare('a', 'b');
compare('a', 'A'); // ASCII Table
compare('apples', 'oranges');
compare('apples', 'applications');
compare('app', 'apples');// smaller left than right
compare('hello', 'hello');//false because are equal
<script type="text/javascript">
        <!--
        if (screen.width <= 1024) {
            document.location = "mobile.html";
        }
        //-->
        </script>
//concatenation 
// join Together 

var part1 = "Hello";
var part2 = "World";

var whole = "Hello " + "World"; 
var whole = part1 + part2; //same as above

console.log(whole);

console.log(whole + " now"); //add string


var multiline = "This is my line 1\n" +
  "This is my line 2\n" +  
  "This is my line 3";
console.log(multiline);

var first = "Pris";
var last = "Ro";
var full = first " + " last;
//Javascript Numbers

//Define a number in Javascript
//Create a number adding it to a variable

//whole numbers 
var a = 11,
    b = -123;


//Decimals
var c = 1.5,
    d = 123.456789;


var e = 0.1,
    f = 0.2;

var result = e * f; //0.0200000000000 -- error


//exponential notation - easy to ready - less error
var g = 1000000; 
var g = 1E6;  // result = 1000000


var g = 1230000; 
var g = 1.23E6;  // result = 1230000

var g = 1.23E16;


var h = 012; // - result = 10 - because (octo or wherever) 
//don't start the number with zero


//Represent a number in hexadecimal mode
//ff 00 00 (16 number)  - ff = 255 (red) - 00 = 240 (green)  - 00 = (blue)

var i = 0xff; // 255
var i = 0xf0; // 240
var i = 0xf;  // 15
var i = 0x10; // 16

// octal number literals
      //  06 ===  6
      //  07 ===  7 
      // 010 ===  8
      // 011 ===  9
      // 012 === 10
      
      
-----------


// Parsing Numbers From Strings
/* Sometimes we need a number that exists as a String, not a literal Number. 
JavaScript provides a couple of methods that will extract a Number from a String.*/

//Parse to work it should start with a number

//Parse in
var j = parseInt("197"); 

//with decimal
var j = parseInt("019", 10); //add second argument


var k = parseInt("010111", 2);


var l = parseInt("23 people", 10);


var l = parseInt("there are 23 people", 10); NaN
//NaN always result NaN - no any number 

console.log(l === NaN)// false - NaN is not equal itself or any other number

console.log(isNaN(l))// true


//Parse float
var m = parseFloat("123.456"); 




-----------



// Operators
// Javascript has built-in operators that make doing math in your programs a very natural process.

var o = 1 + 2; //add
var p = 9 - 6; //substraction

var q = 5 * 5; //multiplication
var r = 8 / 2; //division

// Remainder %
console.log(  6 % 3  );
console.log(  8 % 3  );

// Modulus operator %
var s = 15 % 10; //it going to gives us the reminder of 15 / 10 = 5 

// order of operations * / +
var t = 1 + 2 * 3 / 4; // 2 * 3 = 6 / 4 = 1.5 + 1 = 2.5

// arithmetic () parenthesis goes first of all operators
// parenthesis is call () grouping
var t = (1 + 2) * 3 / 4; // 2.25

var t = (1 + 2) * (3 / 4); // 2.25



-----------


// Comparison
//if structures in combination with special comparison operators. If the condition you specify 
//with comparison operators is met, the instructions inside the if are run.
// Comparing two numbers is necessary in our programs.

console.log( 1 < 2); // true
console.log( 1 > 2); // false
console.log( 1 >= 1); // true
console.log( 1 <= 1); // true

console.log( 1 <= 1.0); // true
console.log( 1 === 1.0); // true | equal to
console.log( 1 === 1.5); // false

console.log( 1 === "1"); // exact match - same type
console.log( 1 == "1"); // true

//exact match
console.log( 1 === parseInt("1", 10)); // true 

//not equal to
console.log( 1 !== parseInt("1", 10)); // false one is not equal to 1 

// ===  opposite !==
//  == opposite !=



console.log( 1 !== 3); // true

if (1 < 2) {
	console.log("Yes");
}else{
	console.log("No");
}
}


var caffeine_mg = 62;
var mood;

if (caffeine_mg < 10) {
  mood = 'grumpy';
} else if (caffeine_mg < 100) {
  mood = 'operational';
} else if (caffeine_mg >= 100) {
  mood = 'winning!';
} 



------------

// The Math Object

// JavaScript provides a library of constants and functions that are useful when doing mathematical operations in JavaScript. 
// These items are stored in an object named Math

// Math object - then call properties or methods - function stored for mathematical operation
// random is a method

var u = Math.random(); // get a random number between 0 and 1

var u = Math.random() * 10; // get a random number between 0 and 10

// Round the number
var u = Math.round(Math.random() * 10); // get whole number ex. 8 - 7...

var v = Math.round(2.3); // 2
var v = Math.round(2.5); // 3
var v = Math.round(2.7); // 3


// Math.floor - Always round down  
var w = Math.floor(3.7); // 3

// Math.ceil - Always round up  
var w = Math.ceil(3.7); // 4


// Math.pow - Power 2 
var y = Math.pow(2, 5); // 2*2*2*2*2 = 32

// Math.sqrt - Square Root
var z = Math.sqrt(4); // 2

// Math.min
// Math.max 


----------


/* Let's meet an interesting symbol called modulo. 
When % is placed between two numbers, the computer 
will divide the first number by the second, and then 
return the remainder of that division.

So if we do 23 % 10, we divide 23 by 10 which equals 
2 with 3 left over. So 23 % 10 evaluates to 3. */



console.log(14 % 3);



//For one thing, it's good at testing divisibility. Consider 30 % 10. What does it return? There is nothing left over, so 0.
//How about 9 % 3? Also 0. We can use modulos in comparisons, like this:

//10 % 2 === 0 evaluates to true
//7 % 3 === 0 evaluates to false because there is 1 left over.

//An example of an if/else statement with modulo in the condition


if( 8 % 4 === 0) {
    console.log("The first number is even");
} else {
    console.log("The first number is odd");
}



// In other words, if you sold 47 items for 9.99 but only paid 5.45 for each item, 
// how much money did you make?

var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;

var salesTotal = retailPrice * quantity
var profit = salesTotal - wholesalePrice * quantity


// Profit made for each unit

var profitPerUnit = profit / quantity


------------

var width = '190px';
var numOfDivs = 10;

var totalWidth = parseInt(width) * numOfDivs



----------

The Math Object

Math.round(2.2)
2

Math.round(49.7)
50


-----------



var temperature = 37.5

alert(Math.round(temperature)); // round 

alert(Math.floor(temperature)); // round down

alert(Math.ceil(temperature)); // round up

---------


// Create a random number
// You can use random numbers to add variety and surprise to your programs.
// Random show a picture everything you open ap page


// runs inside out like math
Math.floor(Math.random() * 6)

var dieRoll = Math.floor(Math.random() * 6) + 1;
alert ("you" + dieRoll)


// What does Math.random() do?
//  A	It produces a random number from 0 up to and but not including 1. 
// For example, it could return 0, 0.3898784155026078 but never 1.

---------

The Random Challenge

- prompt() dialogue to collect user input
- parseInt() function to convert the input to an integer
- Math.random() method to create a random number


---------

var input = prompt("Please type a number");
var topNumber = parseInt(input);
var randomNumber = Math.floor(Math.random() * topNumber) + 1;
var message = "<p>" + randomNumber + " is a number between 1 and " + topNumber + ".</p>";
document.write(message);

// Ask for two numbers and provide a random number between the two


var input1 = prompt("Please type a starting number");
var bottomNumber = parseInt(input1);
var input = prompt("Please type a number");
var topNumber = parseInt(input);
var randomNumber = Math.floor(Math.random() * (topNumber - bottomNumber + 1)) + bottomNumber;
var message = "<p>" + randomNumber + " is a number between 1 and " + topNumber + ".</p>";
document.write(message);




JavaScript
This content will help you familiarize yourself with basic programming concepts in JavaScript. JavaScript is a programming language that runs in Web browsers. To write and run your code you can use repl.it, the open source online programming environment.

Hello, world!
Traditionally the first program one writes is always a greeting to the world of programming: Hello, world! In JavaScript it looks a little something like this:

console.log("Hello, world!");
Paste that into repl.it and run it to see what you get.

What did I just do?
Basically the way you print out messages in a JavaScript program is with a function called console.log. We will talk about functions a bit later, but suffice to say that you can use console.log to print out any message you want. All you need to do is type console.log( (with parentheses), your message within quotes and finally a closing parentheses and semi-colon: );. Try different messages now:

console.log(  "This needs to be in quotes or it won't work!"  );
console.log(  "Help! I'm trapped in the computer."  );
Exercise
Now try not using quotes or leaving out one of the parentheses. What happens?

Values
The reason the quotes are important when printing your message is because JavaScript can handle different kinds of values. When you use quotes you are telling JavaScript that you want to use a text value. Text values are known as strings in programming. An empty string value is valid (although not very useful to print out). Try it:

console.log("");
Another very common value is a number. You don't need to use quotes for numbers. Try it on repl.it:

console.log(9999);
Comments
Comments are parts of the code that you, the programmer, tell JavaScript to ignore. You can use two slashes // to have JavaScript ignore the rest of that line. Try putting a comment before and after printing a message:

// This is a commment
// This is a second comment
console.log("This is a message");  // This is a third comment
What's the point of that? Well comments are used by program authors to leave messages for other programmers. We will leave explanatory messages in some of our code examples for your benefit!

Math and other operations
Values alone aren't so useful until you can start to doing work with them. JavaScript has a few built-in ways to work with values. These are called operators. Basic math such as addition and subtraction are good examples of operators. Try some math and print out the results:

// Addition +
console.log(  10 + 5  );

// Subtraction -
console.log(  7 - 3  );

// Multiplication *
console.log(  6 * 7  );

// Division /
console.log(  8 / 2  );
console.log(  5 / 2  );

// Remainder %
console.log(  6 % 3  );
console.log(  8 % 3  );
Strings also have a basic text operation: combining text using the plus sign +. Try it:

console.log(  "Iron" + "hack"  );
In programming, combining strings is called concatenation.

Exercise
Now we've seen that the plus sign is used for both number addition and string concatenation. What happens when you add a number to a string?

Saving values
Often you are going to want to save a value. There are two main reasons to do that:

You want to re-use the value in several places in your code. Having to re-type long values is tedious and it makes it easier to make a typo.
You want to save the value and change it slowly over the execution of your program.
You save a value in a variable. In JavaScript you first need to declare a variable once and then you can use it as many times as you want. You declare a variable by typing var and the name of the variable. To save a value in the variable you use the equal sign =. Try it:

var city;

city = "Madrid";

console.log(city);

city = "Barcelona";

console.log(city);


var country = "Spain";

console.log(country);

country = "United States";

console.log(country);

country = country + " of America";

console.log(country);
Exercise
Try experimenting with different variable names.

Can you use numbers in your variable name (country13)?
Can a variable name start with a number?
Can you use characters like _, &, ^, ~, -, $ and # in variable names? Try them all.
Making your programs smart
Basic comparisons
To really make your programs interesting they need to start thinking for you! A simple way to do that is checking if values meet certain conditions. To do that you use if structures in combination with special comparison operators. If the condition you specify with comparison operators is met, the instructions inside the if are run. Try it:

var number = 10;

// Equal
if (number === 10) {
    console.log("Number is equal to 10!");
    console.log(number);
}

number = number - 1;

// Not equal
if (number !== 10) {
    console.log("Number is now NOT equal to 10!");
    console.log(number);
}

// Less than
if (number < 10) {
    console.log("Number is less than 10!");
    console.log(number);
}

number = number + 2;

// Greater than
if (number > 10) {
    console.log("Number is now greater than 10!");
    console.log(number);
}

// Greater than or equal
if (number >= 10) {
    console.log("Number is greater than or equal to 10!");
    console.log(number);
}

number = 10;

if (number >= 10) {
    console.log("Number is STILL greater than or equal to 10!");
    console.log(number);
}

// Less than or equal
if (number <= 10) {
    console.log("Number is less than or equal to 10!");
    console.log(number);
}

number = number - 2;

if (number <= 10) {
    console.log("Number is STILL less than or equal to 10!");
    console.log(number);
}
Comparing strings
Strings use alphabetical order for comparison, capital letters being ordered first:

var country;

country = "Australia";

if (country < "Belgium") {
    console.log(country + " is less than Belgium!");
}

country = "australia";

if (country > "Australia") {
    console.log(country + " is greater than Australia!");
}
Combining camparisons
You can also combine different comparisons to make a larger, more specific one using && and ||:

var country, number;

country = "Australia";

// || represents an OR
if (country === "Australia" || country === "New Zealand") {
    console.log(country + " is either Australia or New Zealand!");
}

country = "New Zealand";

if (country === "Australia" || country === "New Zealand") {
    console.log(country + " is either Australia or New Zealand!");
}

number = 15;

// && represents an AND
if (number > 10 && number < 20) {
    console.log(number + " is between 10 and 20.");
}

number = 21;

// No longer runs because number is greater than 20
if (number > 10 && number < 20) {
    console.log(number + " is between 10 and 20.");
}
Doing things when if doesn't match
To catch cases that don't match your if comparison you open an else. Try it:

var number;

number = 21;

if (number > 10 && number < 20) {
    console.log(number + " is between 10 and 20.");
} else {
    console.log(number + " is NOT between 10 and 20.");
}
You can also combine else with another if to make more specific logic:

var number;

number = 21;

if (number > 10 && number < 20) {
    console.log(number + " is between 10 and 20.");
} else if (number <= 10) {
    console.log(number + " is less than 10.");
} else {
    console.log(number + " is greater than 20.");
}
Keep in mind that when using chains of if and else only the section that matches your case will run. The other sections of code will be ignored.

Exercise
How do characters like !, @, #, $, %, ^, & and * affect string comparison? Which is greater: Argentina or !Argentina?
This comparison probably doesn't work like you expect it to. Can you figure out why not?
var number;

number = 101;

if (number !== 101 && number < 25 || number > 100) {
    console.log(number + " isn't 101 AND is less than 25 OR is greater than 100.");
}
Repetitive tasks
Another thing that you will certainly want to do in your programs is perform repetitive tasks. The simplest way to accomplish this is with loops. Loops are blocks of code that run over and over again until a certain condition is met. The condition can be anything you can think of! Just make sure that part of your loop includes code that changes the condition so that it is eventually met. Let's take a look at a loop using for:

var i;

for (i = 1;  i <= 42;  i = i + 1) {
    console.log(i);
}
Huh?
So what's going on there? Here's the structure of a for:

for (  [start];  [condition];  [after-each]  ) {
    [task-code]
}
Basically a for loop wants to run [task-code] a bunch of times. In our example the only code we want to run a bunch of times is printing the variable i. As for that other weird stuff:

[start] is code to run to set some initial state before your loop starts. In our example we just set the initial value of i to 1.
[condition] is the comparison to perform to decide whether or not to keep running the loop again. When i becomes greater than 42 our loop will stop.
[after-each] is the code to run after each time we go through the loop to change the condition. This is supposed to ensure that eventually the condition will not be met and so the loop will stop at some point. In our case, we are adding 1 to i so that we will get closer to 42 every time we go through the loop. Be careful because JavaScript will let you write a loop that never stops (we call them infinite loops).
Exercise
Write a for loop that sings! Starting with one, each run through the loop should print a bunch of la until you print out lalalalalalalalalala. Like this:

la
lala
lalala
...
lalalalalalalalalala
Packaging code
Sometimes you will find the need to package some pieces of your code into self-contained chunks so that you can use them easily in different parts of your program. You can do this by writing a function. Let's look at an example first:

function claimForCountry (country, thing) {
    var claim;

    claim = "In the name of " + country + " I claim this " + thing + "!";

    return claim;
}

var message;

message = claimForCountry("Spain", "land");

console.log(message);

message = claimForCountry("Italy", "pizza");

console.log(message);
function structure
function [name] ( [parameter1], [parameter2], [parameter3]... ) {
    [code]
    return [value];
}
Let's break down function:

A function has a [name] that you call it by. In our example that name is claimForCountry.
When you call it you send it as many [parameters] as it needs. Parameters are just values you send the function. Our example claimForCountry needs two parameters:
country: The name of the country that is making the claim.
thing: The name of the thing that is being claimed.
Then the function runs [code] with those parameters. In our example we declare a variable and set it's value using country and thing.
Finally, after running the code it returns a [value]. In our case we return the claim variable's value.
So when you call claimForCountry it returns a string value which you can use as you see fit. You can also send it different parameters to change the message.

Variations
The structure of function is not super strict. There are certain parts that are optional. For example, you can write a function with as many or as few parameters as you want. Try it:

// No parameters
function hi () {
    return "Hi!";
}

console.log( hi() );

// Five parameters
function addFiveNumbers (n1, n2, n3, n4, n5) {
    return n1 + n2 + n3 + n4 + n5;
}

console.log( addFiveNumbers(10, 20, 30, 5, 7) );
Returning a value is also optional. For example we could have written the hi function to use console.log directly:

// No return
function hi () {
    console.log("Hi!");
}

hi();
However, keep in mind that you may want to do different things with values besides console.log so it's often best to return.

Exercise
Remember we said console.log is a function. Can it handle more than one parameter? How many parameters can it accept?
Write a function that receives a number and prints a countdown of that number all the way to 0 and then Blast off!. For example, blastOff(3) would print this:
3
2
1
0
Blast off!
Structuring values
In your programming travels you will also have need to structure values into more complex patterns. Let's go over the two basic ways of doing that.

Arrays
An array is a list of values within square brackets []. Let's see a quick example:

var countries;

countries = [ "Russia", "Finland", "Morocco", "Brazil" ];

console.log(countries);
Once you create your array, you can pass it around and use it like any other value. You could also think of an array as a row of lockers because each value has a number position assigned to it, starting with 0. You can access each position's value by using square brackets []:

var countries;

countries = [ "Russia", "Finland", "Morocco", "Brazil" ];

// Russia
console.log("The first country is " + countries[0] + "!");

// Finland
console.log("The second country is " + countries[1] + "!");
This makes it convenient to use a for to loop through an array by using the length value attached to the array:

var countries, i;

countries = [ "Russia", "Finland", "Morocco", "Brazil" ];

for (i = 0; i < countries.length; i = i + 1) {
    console.log(countries[i]);
}
You can also use the push function attached to an existing array to add more values to it:

var countries;

countries = [];

countries.push( "Russia", "Finland", "Morocco", "Brazil" );
countries.push( "Canada" );
countries.push( "Mexico", "Japan" );

console.log(countries);
Objects
Objects are similar to arrays except they use curly braces {} for creating them and instead of using numbers to label values, you use strings. These strings are called keys. Objects are great for representing things from the real world in our code. Try it:

var country;

country = {
    name: "Uruguay",
    continent: "South America",
    capital: "Montevideo"
};

console.log(country);
You can access, add or change values in an object in two ways. The first is similar to arrays but using a string and the second is with a dot . between the object name and the key:

var country;

country = {
    name: "Uruguay",
    continent: "South America",
    capital: "Montevideo"
};

console.log( country["name"] );
console.log( country.continent );

country["language"] = "Spanish";
country.population = 3324460;
country.name = "Eastern Republic of Uruguay";

console.log(country);
Finally, you can loop over the keys in an object as well with a special for syntax called for ... in. Try it:

var country;

country = {
    name: "Uruguay",
    continent: "South America",
    capital: "Montevideo"
};

for (key in country) {
    console.log("This country's " + key + " is " + country[key] + ".");
}
When you are using for ... in, remember to use the square brackets [] for accessing values in an object. Using the dot won't do what you expect because country.key will look for a value in the object that's literally called key.

Exercise
What happens when you try to access a value that doesn't exist in arrays and an objects? Try it!
Write a function that receives an array of names and returns them in a string with , between them. The final two must be separated by and.
Write a function that receives an object and returns an array of its values.
Example for #2:

var names;

names = [ "Canada", "Mexico", "Turkey", "Japan" ];

// Should print "Canada, Mexico, Turkey and Japan"
console.log(prepare(names));
Example for #3:

var country;

country = {
    name: "Uruguay",
    continent: "South America",
    capital: "Montevideo"
};

// Should print [ "Uruguay", "South America", "Montevideo" ]
console.log(objectToArray(country));


// Variables and Data type

Write a program that prints the numbers from 1 to 100. 
But for multiples of three print "Fizz" instead of the number 
and for the multiples of five print "Buzz". 
For numbers which are multiples of both three and five print "FizzBuzz".


page control

avanced files

gitgutter

sublime linter
Comments

/*
  HTML = content
  CSS  = Style
  Behavior = Javascript
*/

//single line
/* double line */


/* 
Number    124.04
string    "Hello World"
Boolean   True - False

//Data Types

Even though JavaScript is dynamically typed, there still exists the concept of types of data. In JavaScript you can find 6 different types:

Boolean: true and false.
Number: 1.0, 2.7, 10, .5, 7.34e-2, 077, 0xAB.
String: "hello world!", 'hi again!'.
Object: {name: 'Conan', str: 50}, ['sword', 'helmet'], null.
Function: function (a, b) { return a + b; }.
undefined: undefined.


---

+ concatinate strings

"word "  - the space should be inside the string

; end of the command statement

Prompt 
Learn how to capture data from your visitors and store it in a variable.
var visitorName = prompt ("what is you name?");
alert(visitorName);

prompt (input)

- prompt ("what is you name?")
"Jim" return (no undefined)

- alert ("Hi, " + prompt ("what")) 

- 1 prompt - 2 alert

console log ("hello")

*/

--------------------

//Javascript have its own vocabulary and grammar call

/* syntax
syntax is like the vocabulary and grammar of the programming language.
a programming language's commands, special words and punctuation.
It's like language's words and commands as well as the instructions for putting them 
together to create a program */
// any program languages has their own syntax

//Is like writing a story using the vocabulary and grammar of the program


//Programing concept are general (Javascript - PHP - Ruby)


--------------

alert("Hello world");
//is a statement like a sentences

//you write programs by typing multiple statements


document.write("<h1>Title</h1>");
/* document.write = is a command - document represent the web page and write is a command
that write the message into the page */

//to ways to sent message dialog box and writing into the page


//when the browser execute this line of code the dialog appear on the screen


-------------


console.log("Begin program");
document.write("Welcome to JavaScript Basics");
console.log("End program");  


--------------

// Object - property

message.length

// the dot acces the property of an object


---------
When we program with JavaScript we often work with objects such as a string, the document, and the browser's console.
Objects have properties which are kind of like variables for an object.
They hold information about the object like the length of the string.
Objects also have methods which are actions the object can perform,
like the toUpperCase() method for a string or the document.write() method for the document.

// write is a method of the document
   document.write
   
   
   
---------

Iron hack

As you gain experience as a programmer, you will start to discover some good practices you should follow. Some of these will be focuses on naming and responsibilities. As you get proficient with programming languages, you will spend more time organizing and naming things rather than programming. Comments can be very useful to help us while looking for good names and splitting responsibilities. If you find yourself writing a comment saying 

/* Sort the collections and return the top 10 */ 

you know this code is doing two things: sorting the collection and taking the best 10 so you could split your code in three units, one for making the top 10, another to sort the collection and another one to take the n best. 

Now choose good names for all of them: 
getTop10, sort, getBest could be candidates. 

Because you chose good names, you don't need comments for them anymore. They are self-explanatory and probably short enough to be easely understood.