charlie la fosse
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Publish Note

      Everyone on the web can find and read all notes of this public team.
      Once published, notes can be searched and viewed by anyone online.
      See published notes
      Please check the box to agree to the Community Guidelines.
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Publish Note

Everyone on the web can find and read all notes of this public team.
Once published, notes can be searched and viewed by anyone online.
See published notes
Please check the box to agree to the Community Guidelines.
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags:'Short Course' --- # JavaScript Challenges :turtle: <!-- (repl.it will output double quotation marks as single, i.e "Hello I'm me" will output as 'Hello I\'m me' w backslash before the apostrophe) (also repl only runs the final function (Why)) << it runs all the functions, but also prints the final function to the terminal. You can use console.log to print the others (or is that a question that we're supposed to ask participants?) I think this a questions Charlie had when he wrote this as FAC16 CF :joy_cat: rename func examples to `challenge1()` instead of `yourFunction()` and remember to intro commenting out code (get participants in to practice of commenting out a function before moving on) (and uncommenting a function they want to work on again) --> ## No.1: Write a function that can... Return the string "I am a function" :scream: Hint: this function doesn't need to be passed any arguments! Should return something like: `"I am a function"` --- ## No.2: Write a function that can... Take a number as an argument, and return a new value that is 1 less than the argument. :cactus: For example, if I called your function like so `yourFunction(23);` it should return `22` --- ## No.3: Write a function that can... Speak back to you! :wave: Whatever argument you pass to your function, it should simply return that argument back. So `argumentRepeater("Lemon");` should return `"Lemon"` --- ## No.4: Write a function that can... Take **two** numbers as arguments, and return the sum of them :sun_with_face: For example, if you call your function like this: `addTwoNumbers(12, 56);` should return `68` --- ## No.5: Write a function that can... Say who it was written by! :sunglasses: Your function should take a name as an argument, and return the string "This function was written by ____" So `yourFunction("Charlie");` should return `"This function was written by Charlie"` Hint: the "+" key may come in handy... --- ## No.6: Write a function that can... Take 4 numbers as arguments. It should take the sum of the first two arguments, multiply it by the sum of the last two arguments, and return the result :+1: So `yourFunction(2, 3, 6, 4);` should return `50` Hint: using multiple variables inside the statement of your function might make things easier... --- ## No.7: Write a function that can... Take a string as an argument, and return the length (how many characters) of that string. :straight_ruler: So `yourFunction("How long is this string?");` should return `24` Hint: [This freeCodeCamp challenge](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string) may help you if you're stuck, or try reading up in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length) --- ## No.8: Write a function that can ... Take a number as an argument and returns half that number So `yourFunction(42)` should return `21` and `yourFunction(11)` should return `5.5` --- ## No.9: Write a function that can ... Take two numbers as arguments. If both arguments are equal, return the string `"The first and second arguments are equal"` If the arguments are not equal, return the string `"The first argument ___ does not equal the second argument ___ "`. So `yourFunction(1, 1)` should return `"The first and second arguments are equal"` and `yourFunction(1, 2)` should return `"The first argument 1 does not equal the second argument 2"` Hint: You'll need to use an `if` statement... --- ## No.10: Write a function that can ... Take two numbers as an argument and returns the smallest one. So `yourFunction(11, 2)` should return `2` and `yourFunction(1, -111)` should return `-111` --- ## No.11: Write a function that can ... Take three numbers and returns `true` if the numbers are ascending in size, and false otherwise. So `yourFunction(1, 4, 9)` should return `true` and `yourFunction(4, 1, 10)` should return `false` --- ## No.12: Write a function that can ... Concatenate two strings. So `yourFunction('hi ', 'there')` should return `'hi there'` ## No.13 Write a function that can ... Take an array and a number and return the element of the array at that index. If the number is not a valid index, return `null`. So `yourFunction([7, 3, 5], 2)` should return `5` and `yourFunction([0, 5, 3], 9)` should return `null` Hint: you will need to find the length of the array first, remember zero indexing... ## No.14 Write a function that can ... Take an object, a string, and another value. If the object contains a key that matches the string, return the value corresponding to that key. If the object does not contain a key that matches the string, return the third argument. So `yourFunction({ name: 'felicia', age: 23 }, 'age', 0)` should return `23` and `yourFunction({ name: 'felicia', age: 23 }, 'nickname', 'none')` should return `'none'` ## No.15 Write a function that can ... Take an object whose values are all numbers, and return the sum of those numbers So `yourFunction({ a: 12, b: -4, c: 0.4 })` should return `8.4`

Import from clipboard

Paste your webpage below. It will be converted to Markdown.

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template is not available.
Upgrade
All
  • All
  • Team
No template found.

Create custom template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

How to use Slide mode

API Docs

Edit in VSCode

Install browser extension

Get in Touch

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

No updates to save
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully