@christinaSmith/

function-sytax-samples

JavaScript

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.4522007217848887","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"Y29uc3Qgc2F0ZWxsaXRlID0gIlRoZSBNb29uIgpjb25zdCBnYWxheHkgPSAiVGhlIE1pbGt5IFdheSIKY29uc3Qgc3RhcnMgPSAiTm9ydGggU3RhciIKCi8vYmFzaWMgZnVuY3Rpb24gc3ludGF4CmZ1bmN0aW9uIGNhbGxNeU5pZ2h0U2t5KCkgewogIHJldHVybiAiTmlnaHQgU2t5OiAiICsgc2F0ZWxsaXRlICsgIiwgIiArIHN0YXJzICsgIiwgYW5kICIgKyBnYWxheHk7Cn0KY29uc29sZS5sb2coY2FsbE15TmlnaHRTa3koKSkKCgoKY29uc3QgZnJ1aXQgPSAiYXBwbGVzIgpjb25zdCB2ZWdnaWUgPSAiYXNwYXJhZ3VzIgpjb25zdCBjYXJicyA9ICJicmVhZCIKCi8vYW5vbnltb3VzIGZ1bmN0aW9uIHN5bnRheApjb25zdCB3aGF0c0Zvckx1bmNoID0gZnVuY3Rpb24oKSB7CiAgcmV0dXJuICJNeSBMdW5jaDogIiArIGZydWl0ICsgIiwgIiArIGNhcmJzICsgIiwgYW5kICIgKyB2ZWdnaWUKfQoKY29uc29sZS5sb2cod2hhdHNGb3JMdW5jaCgpKQoKCgpjb25zdCBzcG9ydCA9ICJzb2NjZXIiCmNvbnN0IGhvYmJ5ID0gImtuaXR0aW5nIgpjb25zdCB0YWxlbnQgPSAic2luZ2luZyIKCi8vYXJyb3cgZnVuY3Rpb24gc3ludGF4CmNvbnN0IGNhbGxNeUxpZmUgPSAoKSA9PiB7CiAgcmV0dXJuICJNeSBMaWZlOiAiICsgc3BvcnQgKyAiLCAiICsgdGFsZW50ICsgIiwgYW5kICIgKyBob2JieTsKfQoKY29uc29sZS5sb2coY2FsbE15TGlmZSgpKTs="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const satellite = "The Moon"
const galaxy = "The Milky Way"
const stars = "North Star"

//basic function syntax
function callMyNightSky() {
  return "Night Sky: " + satellite + ", " + stars + ", and " + galaxy;
}
console.log(callMyNightSky())



const fruit = "apples"
const veggie = "asparagus"
const carbs = "bread"

//anonymous function syntax
const whatsForLunch = function() {
  return "My Lunch: " + fruit + ", " + carbs + ", and " + veggie
}

console.log(whatsForLunch())



const sport = "soccer"
const hobby = "knitting"
const talent = "singing"

//arrow function syntax
const callMyLife = () => {
  return "My Life: " + sport + ", " + talent + ", and " + hobby;
}

console.log(callMyLife());
Native Browser JavaScript