Skip to content

kriti-rai/javascript-bind-lab-g-416

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript bind() Lab

Overview

In this lab, you'll use and be able to identify when to use bind().

Tick, tock...

Old clock

That's it. We've had to repair this old clock too many times now. Let's create a digital one instead!

  1. Create an object called digitalClock
  2. This object should have two properties:
    1. time: the current time in seconds, rounded off (Hint: take a look at Date)
    2. startTicking: a method that increases the time property with one second every second. Use .bind() or ES2015 arrow functions to correctly set the property!

So much for free speech

Fox Censor

Let's automate the censoring process for Fox TV!

  1. Create a function called censor. This function takes two arguments: the word being censored, and the string that should be sanitized. Don't worry about case matching for this exercise.
  2. The censor function should return the input string, with the censored word being replaced with 'BLEEP'.
  3. Create a violenceCensor function (using .bind() and the censor() function) that will censor the word 'violence'.
  4. Create a drugsCensor function (using .bind() and the censor() function) that will censor the word 'drugs'.

Resources

View Bind Lab on Learn.co and start learning to code for free.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 77.8%
  • HTML 15.5%
  • Shell 6.7%