These are some code snippets on how to create functions to check if a number is even. Do a factorial with a for loop. Do a text replacement with regular expressions.
These are some examples of simple for loop challenges and exercises I did for fun.
First create a folder:
Then CD into that folder through CMD
Then do the follow in command-line
npm install -g babel-cli
npm install babel-preset-es2015–save-dev
Then create app.js.es6 file
Then use this example code:
babel app.js.es6 –presets2015 | clip
Clip copies the string from commandline. Then you should get the follow code output:
Now we want to create an index.html file
babel app.js.es6 –presets es2015 > 5
Now we are going to create a file called .bablrc this file will shorten the command to compile the babel file
babel app.js.es6 > app.js
Public data would be returned.
I hope you found this code snippet useful in your coding. These are higher order examples of code has to deal with object orientated programming. You can apply these concepts elsewhere.
Public functions can be access and changed anywhere. Where as private can’t be changed the numbers stay static. For example gifts will stay 3, but the public function can subtract it in increments of negative 1.
The reason behind public and private is track bugs. If you have too many public/global variables you get lost quick and other variables can overwrite those current variables, which is something you don’t want. Plus there is name spacing here the namespace is THINGS.
just type it without bin
Then you should be fine. Same with every other command your trying to follow
These are list of following of reserved characters for links:
! # $ % & ( ) * + , / : ; = ? @ [ ]
These characters need to be encoded so it doesn’t interfere with the function of the URL.
These characters will turn into %21 hexadecimal characters.
A fix for this is
- Letters, numbers, underscores, and dash are unchanged
- Reserved characters become % + 2 digit hexadecimal
- Spaces become “+”
- Use this for query string after that ?
- rawurlencode should only be used for file path
- path is the part before “?”
- spaces must be %20
- it’s newer