JS practice with notes

In this example below you will see how to do a JS practice with notes with some HTML / CSS and Javascript

This awesome code was written by 120hit, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 120hit ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>JS practice with notes</title>



    <script  src="js/index.js"></script>



/*Downloaded from https://www.codeseek.co/120hit/js-practice-with-notes-GvOmzq */
//youtube - "lesson 1 - intro to JavaScript. Mini JavaScript Bootcamp by LambdaSchool"
//time 43:00 in youtube

function sayHi(){
  console.log('hello! ');


/* the function calls sayHi on line 8, line 5 then calls back to function, oks it then line 1 function accepts it to print out hello */

//concatenating  = adding strings together 

function sayHi(name) { //we are passing a value called name in the sayHi function
  var greeting = 'hello ' + name; //hello is concating with the name
  console.log(greeting); //console is gobal/object - log is a function, we call them methods as well

sayHi('rohit'); //rohit is a argument/value
//var name1 = 'rohit';

/* so the function sayHi has a argument called name, within that we have the var called greeting with the print info called 'hello' + name
so first the main function calls sayHi on line 17, then the sayHi function on line 17 then pass that in as a argument which is 'rohit', line 17 is declared as inline code, we can also not make it into non-inline code with the example of line 19-20, its the same thing*/

 change.log("this is jQuery")

//You've just discovered some peculiar behavior in JavaScript. It’s called 'implicit type coercion' and it's a feature of JavaScript. JavaScript multiplies the 5*10 to become 50 and then changes the number 50 into the string "50", so you're adding together the same data type. This then gets combined with the string "Hello". You'll learn more about why this happens later in this lesson.


//console.log("hello" + 5*10) /\ "hello50"
//Naming conventions
//When you create a variable, you write the name of the variable using camelCase (the first word is lowercase, and all following words are uppercase). Also try to use a variable name that accurately, but succinctly describes what the data is about.

//var totalAfterTax = 53.03; // uses camelCase if the variable name is multiple words
//var tip = 8; // uses lowercase if the variable name is one word
//converting 12c to F
// var celsius = 12;
// var fehrenheit = celsius * 1.8 + 32;
//console.log(fehrenheit)  // /\ 53.4F
 // Indexing
//Did you know that you can access individual characters in a string? To access an individual character, you can use the character's location in the string, called its index. Just put the index of the character inside square brackets (starting with [0] as the first character) immediately after the string. For example:

//"James"[0]; /\ "J"
  //var quote = "Stayj awhile and listen";
//console.log(quote[6]); /\ w
  //Alternatively, you can use the String’s charAt() method to access individual characters. For example, quote.charAt(6) would also return "w". You’ll learn more about methods later in this course.
  var dogSays = function(dog){
    var dogMessage = "";
    for (var i = 0; i < dog; i++){
      dogMessage += "wolf ";
    return dogMessage;
  function helloDog(callbackFunc){
    return "hello" + callbackFunc(3);