DIR Return Create A Forum - Home
---------------------------------------------------------
BotBitsand Nix
HTML https://botsbitsandnix.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: javascript
*****************************************************
#Post#: 53--------------------------------------------------
just some basic javascript
DIR By: Nixsy
Date: April 23, 2021, 8:17 pm
---------------------------------------------------------
here is a little javascript to brighten your day
this is probably the first program anyone learns its a simple
script to output the words hello world to the comsole.log
1:hello world
--- Code ---
function hello(x){
console.log(x)
}
function world(y){
console.log(y)
}
hello("hello")
world("world")
--- End Code ---
#Post#: 54--------------------------------------------------
Re: just some basic javascript
DIR By: Nixsy
Date: April 23, 2021, 8:24 pm
---------------------------------------------------------
2:basic math
this function gives a value to x and y then passes it to a
function with the goal of adding them together it then outputs
the result to the console via the log command
--- Code ---
var x = 1;
var y = 2;
function add(x,y){
return(x+y)
}
console.log(add(x,y)
--- End Code ---
#Post#: 55--------------------------------------------------
Re: just some basic javascript
DIR By: Nixsy
Date: April 23, 2021, 8:30 pm
---------------------------------------------------------
3: iteration
this function is a simple way of increasing numbers
in this function every time increase is called x grows by 1
simnce its a global variable we do not need to add another
number to iy
--- Code ---
var x=1:
function increase(){
x++;
return x;
}
console.log(increase())
console.log(increase())
--- End Code ---
*****************************************************
Page 1 of 1