Week 1 Flashcards
(38 cards)
What does pwd stand for and what does it do in bash
present working directory
it will show you the directory you are currently working in
what does cd stand for and what is it used for in bash
change directory
it will move you to the specified directory
what does mkdir stand for and what is it used for in bash
make directory
it makes a new directory
what does ls stand for and what is it used for in bash
list the content of the present directory
what does touch stand for when entered before a custom string in bash and what is it used for
touch + <string> will generate a new file in the current directory and specifically it will check to see if a file with this name exists in this directory. If not, it makes a new empty file with this name. If it does exist it updates the "last modified" timestamp on the file.</string>
When creating a new file in a directory in bash what should be added to the front of that file to make it hidden by default
. a period at the beginning of the file name will make it hidden. ex touch .hidden
when adding flags to a command like li for list in bash how many flags can you add and what order do they need to be in
you can add as many as you would like and they do not need to be in a specific order. ex
$ ls -l
$ ls -al
$ ls -la
all of the above will work.
does hidden prevent the bash from seeing the file entirely
No. using flags like list will only show non hidden files but flags like -a will show them
What is a flag for a command in bash
These act as options for the command. It allows you to get a specific kind of detail or functionality out of a command
in bash when you see a ~ (tilde) symbol what is it referencing? and how can it be used in bash
the ~ tilde represents the originating directory in bash and using it with commands like cd will direct you to that directory
how do you go up in the directory in bash
cd .. will send you up 1 in the directory
what is the difference between a relative path and an absolute path in bash
A relative path is based on bash’s current directory and allows you to easily access directory’s relative to your location. A absolute path can be used anywhere and contains the full path.
ex. relative path ~Desktop/NucampFolder
ex. absolute path cd c:/Users/<username>/OnceDrive/NucampFolder</username>
what can the up and down arrow be used for in bash
up will take you to your last used command and down will take you to the most recent. This is logged as a list so you are navigating up and down the list of recently used commands
name 3 ways to find a recently used bash command
up and down arrows
$history
ctrl+r to search
How do you add JavaScript to an HTML page?
Using the
element
How can you prevent JavaScript code from running immediately when the page loads?
By wrapping it in a function declaration
What’s the syntax for creating a function in JavaScript?
function functionName() { // code here }
How can you call a JavaScript function from an HTML button?
Using the onclick event handler, e.g., <button></button>
<body>
<button>Click Me</button>
<script> function sayHello(){ alert("Hello World!"); } </script>
</body>
What’s the purpose of the <!DOCTYPE html> declaration?
It specifies that the document is using HTML5
<!DOCTYPE html>
<html>
<head>
<meta></meta>
<title>JavaScript Hello World</title>
</head>
<body>
<button>Click Me</button>
<script> function sayHello(){ alert("Hello World!"); } </script>
</body>
</html>
What terminates statements in JavaScript and what is a statement
Statements are terminated with a ; (semicolon)
Statements are instructions to the computer
ex. let myScore;
is a statement that says. Create a variable named myScore
What is the difference between the LET and CONST declarations in JavaScript
LET is used for variables where the values could be reassigned
CONST is used for variables where the values will not, can not and should not be reassigned.
What is a declaration in JavaScript still seen today that should not be used moving forward based on best practice established with a change in 2015 that brough in new declarations?
VAR is a declaration you may see still today in legacy code but you should no longer use since CONST and LET have been added in 2015
in JavaScript what is the difference between NULL and UNDEFINED
NULL is an empty / non-existent value, intentional absence of a value
UNDEFINED is a value given to variables that have been declared but not initialized
NULL - Let x = null;
UNDEFINED - Let x;
JavaScript is a dynamically types language. What does this mean?
a variable can be of any data type and can be changed to another data type during execution.