Skip to content

Instantly share code, notes, and snippets.

@codenart
codenart / dropdown.html
Last active July 5, 2018 02:19
Using for tutorials on codenart.github.io
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>A weird dropdown :D</title>
<link rel="stylesheet" href="dropdown.css">
</head>
<body>
<div class="dropdown">
@codenart
codenart / function.js
Last active June 16, 2018 12:18
Using for tutorials on codenart.github.io
function just() {
return 'nothing';
}
console.log( just.name );
// 'just'
console.log( just.apply() );
// 'nothing'
@codenart
codenart / string.js
Last active June 17, 2018 02:34
Using for tutorials on codenart.github.io
var knowing = 'infinite';
console.log( knowing.length );
// result: 8
var intellect = knowing.slice(2);
console.log(intellect);
// result: 'finite'
@codenart
codenart / number.js
Last active June 22, 2018 03:46
Using for tutorials on codenart.github.io
var infinity = 10.01;
var ten = infinity.toPrecision(2);
console.log(ten);
// result: 10
@codenart
codenart / date.js
Last active June 14, 2018 05:38
Using for tutorials on codenart.github.io
var date = new Date();
var dateString = date.toUTCString();
console.log(dateString);
// 'Thu, 14 Jun 2018 05:37:29 GMT'
@codenart
codenart / class.js
Last active June 16, 2018 06:26
Using for tutorials on codenart.github.io
// creating a sketch
class Thing {
constructor(givenColor, givenAge) {
this.color = givenColor;
this.age = givenAge;
}
whisper() {
console.log(this.age + ' years ago...');
console.log(this.color + '...');
@codenart
codenart / this.js
Last active June 12, 2018 13:20
Using for tutorials on codenart.github.io
var theTree = {
name : 'Divine' ,
age : 1001 ,
produce() {
return '108 fruits';
},
whisper() {
console.log(this.age + ' years ago...');
@codenart
codenart / object.js
Last active June 12, 2018 09:08
Using for tutorials on codenart.github.io
var theTree = {
name : 'Divine' ,
age : 1001 ,
produce() {
return '108 fruits';
}
};
console.log( theTree.name ); // 'Divine'
var box = 'outer';
function just() {
// var box = 'inner';
console.log(box);
}
just();
// result: 'outer'
@codenart
codenart / scope.js
Created June 9, 2018 07:27
Using for codenart.github.io
function just() {
var box = 'something';
}
console.log(box);
// result: undefined