JavaScript Usage
Testing usage of JavaScript using Jupyter Notebooks
JavaScript Usage | Table Using JavaScript and HTML Fragments |
Unit 3
Notes | Hacks | Grade |
3.1-3.2 Notes | 3.1-3.2 Hacks | 0.95/1 |
3.3-3.4 Notes | 3.3-3.4 Hacks | 0.9/1 |
3.5-3.7 Notes | 3.5-3.7 Hacks | 0.95/1 |
3.8 & 3.10 Notes | 3.8 & 3.10 Hacks | 0.9/1 |
3.9 & 3.11 Notes | 3.9 & 3.11 Hacks | 0.8/1 |
3.12 & 3.13 Notes | 3.12 & 3.13 Hacks | 0.95/1 |
3.14 & 3.15 Notes | 3.14 & 3.15 Hacks | 0.9/1 |
3.16 Notes | 3.16 Hacks | TBD |
Solving Physics Problems
Lets see if we can use math in JavaScript to Solve for physics problems
A car moves with a constant acceleration of 2.00 m/s² along a straight line from point A to point B starting from a speed of 5.00 m/s, taking 10 seconds. What distance does the car travel assuming the place where the car starts is the point of reference?
function solve(Δx) {
var t = 10 // Variable t represents time
var a = 2 // Variable a represents acceleration
var vᵢ = 5 // Variable v represents the initial velocity
var Δx = (vᵢ * t) + (0.5 * a * Math.pow(t, 2)) // Kinematic Equation for position as a function of time
}
function logIt() {
console.log("Use the kinematic equation Δx = vᵢt + at²");
console.log("plug in the known values: Δx = (5)(10) + (2)(10)²");
console.log("The car travels", Δx, "meters");
}
logIt()