Skip to content

Instantly share code, notes, and snippets.

@cbetta
Created November 4, 2018 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbetta/981a71594b6d96d69e698fab47648f60 to your computer and use it in GitHub Desktop.
Save cbetta/981a71594b6d96d69e698fab47648f60 to your computer and use it in GitHub Desktop.
week2.js
let i = 0
console.log(i)
i += 1
console.log(i)
i++
console.log(i)
const j = 0;
j++
let under_hundred = i < 100
console.log(under_hundred)
for(let index = 0; index < 100; index++) {
console.log(index)
}
let array = [1, 2, 3, 4, 5]
for (let index = 0; index < array.length; index++) {
const element = array[index];
console.log(element)
}
let name = 'Cristiano'
console.log(name[0])
console.log(name.length)
let hello = function() {
return 'Hello World'
}
console.log(hello)
console.log(hello())
hello = (name) => {
return "Hello " + name
}
console.log(hello("Cristiano"))
output = (string) => {
console.log(string)
}
array.forEach(output);
let outputDate = () => {
console.log(new Date().toLocaleString());
}
setInterval(outputDate, 100)
outputDate = () => {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(new Date().toLocaleString());
}
setInterval(outputDate, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment