Giter Club home page Giter Club logo

appacademy_debugscriptspractice's Introduction

Long Practice: Window Object and Debugging

In this practice, your tasks will be to use the window object to manipulate a basic portfolio page, find objects within the document by implementing some search functions, and import/export files with ES6 modules.

Set up

Clone the practice from the starter.

Run node app.js to start the application. Navigate to localhost:5000 in your browser and follow the instructions below.

Phase 1: Connecting HTML with JavaScript

You will be provided an index.html file within the assets folder that contains a basic portfolio site. Connect the /assets/js/index.js to the HTML page to execute it once the HTML page loads the JavaScript file. Load is as a JavaScript module.

Make sure the code in the index.js file executes only after everything on the HTML document has loaded.

Phase 2: Connecting JavaScript Modules

You'll notice there are some calls to functions that don't exist in the index.js file. These functions exist in /assets/js/manipulate.js and /assets/js/search.js. Your task will be to properly export those functions from those files and import them into the index.js file using ES6 modules.

Debug your import/export statements using the "Console" tab in your browser's Developer Tools.

Phase 3: Filling out the Modules

Now that you've connected everything, the functions being called need to be filled in! Start in /assets/js/manipulate.js.

Here you will find functions that manipulate the document in various ways. Read the comments within the functions to complete the functions accordingly. To change the text inside of an HTML element, set the .innerText property on the element to a different value. For example, the following code will change the text content of the body HTML element to "Hello World!".

document.body.innerText = "Hello World!"

Use the "Console" tab in your browser's Developer Tools to test your code. Add debuggers in your code to freeze the code execution on that line to examine the variables at that time of execution.

BONUS Phase

Here you will combine your knowledge of search algorithms and the DOM. You can think of the DOM as a tree, where each item in the DOM (e.g. <div>, <p>, etc.) can be considered a node of the tree.

The search functions are described in /assets/js/search.js for you to complete (e.g. findElementById, findElementsOfTag, etc.). You may find the .children, .tagName, and .classList properties of an HTML element to be useful. If necessary, you may create your own helper functions.

To view the output of the functions in search.js, use console.log() to print the results of calling the functions in index.js.

appacademy_debugscriptspractice's People

Contributors

chriscarucci avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.