Conteúdo do Curso
Introduction to JavaScript
Introduction to JavaScript
3. Performing Operations in JavaScript
Understanding Assignment OperatorsMathematical Operations in JavaScriptAssignment Operators in JavaScriptIncrement and Decrement OperatorsChallenge: Variable Operations PracticeComparison Operators in JavaScriptLogical Operators ExplainedChallenge: Compare Variables in JavaScriptConcatenating Strings in JavaScriptChallenge: Build Sentences with JavaScript
4. Controlling Program Flow with Conditional Statements
5. Looping Through Data in JavaScript
Challenge: Write a Function – My Name
Task
Implement a function to output a sentence:
Name the function
myName
.The function should accept one argument,
name
.The
myName
function body should contain aconsole.log()
statement that prints the sentence"My name is {name}"
.Call the
myName
function three times with different names.
function ___(___) { console.log("My name is", ___); }; myName("___"); myName("___"); myName("___");
The output should be:
python
Function definition:
function funcName(argument) {}
.Place the argument name inside the
console.log()
function.Call the function with different names (choose them yourself).
Call the
funcName
function after defining it using thefuncName(value)
syntax.
function myName(name) { console.log("My name is", name); } myName("Ashley"); myName("Ervin"); myName("Mabel");
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 6. Capítulo 3