CS174
Chris Pollett
Oct 31, 2022
git config --global user.name "YOUR NAME" git config --global user.email "YOUR EMAIL ADDRESS"
https://github.com/ORIGINAL_USERNAME/PROJECT.gityour fork will be
https://github.com/YOUR_USERNAME/PROJECT.git
git clone https://github.com/YOUR_USERNAME/PROJECT.git
git remote add upstream https://github.com/ORIGINAL_USERNAME/PROJECT.git
https://GITHUB_ACCESS_TOKEN@github.com/YOUR_USERNAME/PROJECT.gitI.e., this is what you should set your remote.origin.url equal to.
git push origin masterto send them back to GitHub in our workspace on GitHub.
git fetch upstreamthen check out our local branch
git checkout masterand finally merge changes (we might need to resolve conflicts like described earlier)
git merge upstream/master
Which of the following statements is true?
We now want to consider adding dynamic behaviors to our websites as they are interacted with on the client-side. To do this, we will use the Javascript language.
<script type="text/javascript"> -- code -- //for HTML5 don't use type="text/javascript" </script>
<script type="text/javascript" src="myscript.js" />
return x; // has the effect of just return!
<html> <head><title>test</title> <meta name="description" value="this example illustrates how Javascripts are executed both when the document is loaded and on the occurrence of events" /> <script type="text/javascript" > function sayHello() { alert("hi there"); } </script> </head><body><form><input type="button" value="test" onclick="return sayHello();" /><!-- responds to events --></form> <script type="text/javascript" > for( i = 0; i<100; i++) { document.writeln("<p>hi"+i+"</p>"); } // run when document loads </script></body> </html>
//Declaring variables with function scope var my_variable; // don't need to assign a var when declaring it var pi=3.14; // but can var a=1,b; //can declare more than one variable in one go // declaring variables with block scope let my_other_var; //let first appeared in Ecmascript 2015 let foo = 2; let c=4,d; { let e =10; var f = 7; console.log(e + " " + f); //prints 10 7 } console.log(e); // ReferenceError console.log(f); // 7
const PI = 3.14;
first = "hello" second = first + "bye" // "hellobye" alt_second = `${first} bye` //"hello bye" back ticks in JS can be used //if you want variable interpolated strings
"August" + 1977 // "August1977" 1977 + "August" // "1977August" 7*"3" =21
var str_value = String(value); // Might want to use toString var some_number = Number(some_string); // Might want to use parseInt or parseFloat