Skip to content

Instantly share code, notes, and snippets.

@djoudi
Created February 10, 2023 14:27
Show Gist options
  • Save djoudi/c29ec04194cd2ca4bf0bf858ea4a75a7 to your computer and use it in GitHub Desktop.
Save djoudi/c29ec04194cd2ca4bf0bf858ea4a75a7 to your computer and use it in GitHub Desktop.
// variable with type
// const
// operation
// comparisation
// condition
//loop
//function
// ds
//dsfdfsdfdsf
/*
1 byte = 8 bit
*/
var x = 15
// azAZ$_
//azAZ_$09
//var _st_$3 = "Ecoin"
// number string boolean object array
var num1 = 25 // integer
var num2 = 36.9 //float
var num3 = 20195.98745 // double
var str1 = "Welcom to ecoin" // String
var str2 = 'A' // String char
var isAdmin = true //boolean bool
var isUser = false // boolean
//console.log(str1)
//console.log(num2)
var tab = [45, 36, "Ecoin", true, 2016]
//console.log(tab)
var tab2 = new Array(45, 36, 9, 8, 7)
//console.log(tab2)
var tab3 = new Array()
tab3[0] = "Ecoin"
tab3[1] = 28
tab3[2] = 2.66
tab3[3] = 203
tab3[4] = false
//console.log(tab3)
//console.log(typeof tab2)
var tab4 = [14, 36, "Ecoin", 2023]
tab4['test'] = 88
//console.log(tab4)
//Object
var student = { nom: "Ahmed", prenom: "kadri", age: 25 }
//console.log(student.age)
//console.log(typeof student.age)
const PI = 3.14
//console.log(PI)
const project = "Ecoin"
// + - * / %
var x = 25
/*
console.log(x + y)
console.log(x - y)
console.log(x * y)
console.log(y / x)
console.log(y % x)
*/
//x = x + 9 // x+=9
/*x += 9
console.log(x)
x = x - 9 // x-=6
x = x * 9 // x*=6
x = x / 9 // x/=6
*/
//x = x + 1 // x++ /incrementation
//x++ // x--
//console.log(++x) //25
//console.log(x++) //25
var a = 19
var b = 23
// == != > >= < <= ! ===
var t = a > b
//console.log(!t)
var c1 = 25
var c2 = "25"
//console.log(c1 === c2)
//console.log(true & true)
/*
true && true ===> true
true && false ===> false
false && true ===> false
false && false ===> false
true || true ===> true
true || false ===> true
false || true ===> true
false || false ===> false
*/
// condition nested if
/*var x = 45
if (x >35)
console.log("Yes");
else if (x > 25)
console.log("X > 25")
else
console.log("OK")
console.log("Ecoin")
*/
/*
var a1 = prompt("please enter number1")
a1 = parseInt(a1)
var a2 = prompt("please enter number2")
a2 = parseInt(a2)
if (a1 > a2) {
console.log("A1 > A2")
} else if(a1 < a2) {
console.log("A2 > A1")
} else {
console.log("A2 = A1")
}
*/
//console.log(typeof a1)
//a1 a2 a3 >=
/*
a, b, c
a >= b ==> t ==> a >= c
==> f ==> b >= c
*/
/*
var a = prompt("please enter number1")
a = parseInt(a)
var b = prompt("please enter number2")
b = parseInt(b)
var c = prompt("please enter number2")
c = parseInt(c)
if (a >= b ) {
if (a >= c) {
if(a%2==0) console.log(a+" is pair")
else console.log(a+" is impair")
} else {
if(c%2==0) console.log(c+" is pair")
else console.log(c+" is impair")
}
} else {
if (b >= c) {
if(b%2==0) console.log(b+" is pair")
else console.log(b+" is impair")
}else {
if(c%2==0) console.log(c+" is pair")
else console.log(c+" is impair")
}
}
*/
//loob
var i = 1
while (i<=5) {
console.log("Ecoin"+i)
i++
}
var j = 1
do {
console.log("JS "+j)
j++
}while(j<=10)
var t = []
var s = 0
while (s <= 4) {
t[s] = "Ecoin " + s
s++
}
console.log(t)
var s1 = 0
while (s1 <= 4) {
console.log(t[s1])
s1++
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment