Skip to content

Commit

Permalink
node
Browse files Browse the repository at this point in the history
node
  • Loading branch information
vxiongIcstarsTest committed Nov 15, 2023
1 parent 1669504 commit fd5f330
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 0 deletions.
158 changes: 158 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,161 @@ let arry = [2, 4, 6, 8, 10, 12, 14, 16];
let lastElement = arry[arry.length - 1];

console.log(lastElement);
//variables - container for data to be used
// for later


// let - are mutable / values that can change
let number = 15

number = 10

console.log(number)

// console.log is putting it into the consoles

// const / immutable / cannot change
const name = 'Collin'

// 'Collin' - a string, boolean, numbers
// because it's on the right side of the '='

// name = 'Vince'

// var - won't really use

var number2 = 0

number2 = 10

// Data Types

// Number/integer
let x = 2

let y = 2.5

let z = x + y

let b = 1000000

console.log(2**4)

// 2**4 means 2 to the power of 4. this is used
// for gaming

// String - sequence of characters
// '', "", ``
const name2 = "You're"

console.log(name2)

// Concatenation - adding two strings together
let sentence = 'hi'
let sentence2 = 'bye'
let sentence3 = sentence+sentence2
let sentence4 = sentence + ' ' + sentence2
let sentence5 = sentence + sentence2
let sentence6 = `Hi, my name is PhaNyia`
// ${} - template literal - always use bat tics
let sentence7 = `Hi, my name is PhaNyia. ${sentence2}`

console.log(sentence3)
console.log(sentence4)
console.log(sentence5)
console.log(sentence6)
// ${} - template literal - always use bat tics
console.log(sentence7)

let o =200

let s = `${o}`

let num = '20,000'

let num2 = 20

console.log(num + num2)

const num3 = 10

console.log(num3) // prints to the console

// Booleans

// Truthy - anything with value
// 1
// 'Great' - a string
// True

// Falsy - undefined; no value
// 0
// ' ' - empty string
// false
// undefined
// null

// console.log(Boolean()) - can let you know if
// something is true or false
// negative numbers will still be a truthy
console.log(Boolean(-1))


let sentence8 = `Hi, my name is ${name} and I am ${num3}`




// what is an array ? - a list of data
let emptyArr = []
console.log(emptyArr);
const lengthOfEmptyArray = emptyArr.length;
console.log(lengthOfEmptyArray);

const mixArr = [1, "Collin"]
console.log(mixArr)
const name4 = "Lucycan";

const nameArr = ["Lucycan", "Collin", "Mark"];
console.log(nameArr);
const lengthOfNameArr = nameArr.length;
console.log(lengthOfNameArr);

const hello = `Hi, my name is ${nameArr[1]}.`;
console.log(nameArr[1])


// submitting form
nameArr.push("Cortez");
nameArr.push("Romeo")
console.log(nameArr);

// grabs the most recent submission so it will grab "Romeo"
console.log(nameArr.pop());
let arr = []

//what is an array?

const emptyArr = [];
console.log(emptyArr);
const lengthOfEmptyArry = emptyArr.length;
console.log(lengthOfEmptyArry);

const mixArr = [1, Collin]

const nameArr = ["Lucycan", "Collin", "Mark"]
console.log(nameArr)
const lengthOfNameArry = nameArr.length;
console.log(lengthOfNameArr)

const hello = `Hi my name is ${nameArr[1]}`
console.log(Hello);

console.log(nameAAr[1]);

nameArr.push("Cortez");
nameArr.push("Remeo");
console.log(nameArr);

console.log(nameArr.pop())

30 changes: 30 additions & 0 deletions note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
let arr = [1,2,3,4,5]

let lastItem = arr.slice(-1)

let num = lastItem.slice(0)

console.log(arr, num)

arr1.push(90)

arr1.pop()
console.log(arr1)

console.log(Math.random() * arr1.length)

// For Loops
// It repeats a task or code a certain number of times based on a condition


//split() - splits a string by the specified character

// join() - joins array elements between a specified character
// let arr = ['c', 'o', 'l','l','i','n']

let str = 'collin'

console.log=(arr.join(''))

let arr =
console.log

0 comments on commit fd5f330

Please sign in to comment.