Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions functionExercise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function addition(){
var a = 13
var b = 44
var c = a + b
Console.log("13 + 44 = " , c)
}

function subtraction(){
const d = 56
const e = 8
const f = d - e
Console.log("56 - 8 = " , f)
}

function multiply(){
let value1 = 3
let value2 = 5
let multiplyValues = value1 * value2
Console.log( "3 * 5 = ", multiplyValues)

}

function divide(){
var g = 8
var h = 3
float i = g / h
Console.log( "8/3 = ", i)
}

addition()
subtraction()
multiply()
divide()
2 changes: 2 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ body {
flex-direction: row;
flex-wrap: wrap;
width: 75%;

background-color: red;

border-bottom-left-radius: 15px;
}

Expand Down
15 changes: 14 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@
<html>
<head>
<link rel="stylesheet" href="./index.css">
<script src="index.js"></script>
</head>
<body>
<!-- added Ex
<script>
console.log("inside html") //write javascript inside html, not common, too long code
var number = 1+2
console.log(number)
</script
-->

<div class="name">
<h1 class="header-name">rw400</h1> <!-- added Ex -->
<button class=button-class">Submit</button> <!-- added Ex -->
</div>
<div class="calculator">

<!-- Display region where numbers will be shown -->
<div class="display"><p>1.2</p></div>

<
<!-- Container holding all the divs -->
<div class="button-container">

Expand Down
118 changes: 118 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// ; is optional in modern javascript, make sure it is consistent
var x = 5.5 //number
console.log(x) //prints to the terminal, browser
console.log("this is test:)

var x2 = 5.5

var x3 = x + x2
console.log(x3)
console.log("value", x3)

var x = 99 //override x value
console.log(x) //new x value in console

var x = "this is a string" //override again to string
console.log("x", x)

var string = x + "9" // string concatenation
console.log(string)

var y = "blockchain" //string

var z = y + x
console.log(z)

const firstname = "John" //cannot override, change
const lastname = "Doe"
const fullname = firstname + " " + lastname
console.log(fullname)

var nnumber_1 = 55 //underscores are fine but not -
var numberNumber = 66 //standard way of defining lowercase then uppercase
var sum = number_1 + numberNumber
console.log(sum)

var difference = number_1 - numberNumber //subtraction
console.log(difference)

var string1 = "string concatation"
console.log(string1.length) // gives length of string

var upperString = string2.toUpperCase() //Caps all the values
Console.log(upperString)

var lowerString = upperString.toLowerCase() //Lowercase all values
Console.log(lowerString)

function demoFunc() {
console.log("this is a funciton")
var a = 22
var b = 33
var c = a + b
Console.log(c)
}

demoFunc()

funciton secondFunction(){
const x = 3;
const y = "number"
const z = x + y //auto detects as string 3number is now a string
console.log("z : ", z)
}
secondFunction()

function awesomeFunction(){
let firstName = "John"
let lastName = "Doe"
let fullName = firstName + lastName //scoping: ( global , override)

console.log(fullName)


}



/*
javascript is dynamically packed language
don't have to define like other languages, ex just put 5


String
Number
int
dec -decimal
float -many decimals, more specific

variable types: (fixed)
var
var x = 5
var x = 10, fixed now x i 10

CONT
constant at the top, unchange

let
work in certain scope, like in a loop
only works inside loop AND NOT outside loop
Ex. let x = 5
dont have to re delare, re define

Operators
+ , - , * , / basic math operator
++ incremental operators, increment by 1
-- de-increment by 1
= assign value
== it has the same value, compare
=== same value and same type








*/