could anyone clarify more the word meanings of the below words in javascript language.
1.assign=…
2.resolve=…
3. augment=…
4.initialize=…
5.label=…
6. literal=…
7. mad libs=…
8.appending =…
assign
store some value in memory under a name
let a = 1
That means assign the value 1
to the name a
. You can now access that value as a
.
resolve:
settle or find a solution to (a problem or contentious matter).
Given a name of something, find its value. If I resolve a
, the value I get is 1. If I have a function myFunction
, functions are called by using parentheses, so I’d resolve that to a value like myFunction()
augment means to increase the size or value of something by adding something to it. Definition doesn’t change to be JS-specific. See https://dictionary.cambridge.org/dictionary/english/augment
It is sometimes used to refer to [I guess best way to describe this] adding functionality to an existing object or a class (ie the template for creating the object). This is not a common thing, as it refers to some quite specific techniques, but it may be the thing you’re alluding to.
initialize
Normally refers to a new variable being created with a value (let i = 0
)
label
Specifically in the context of JavaScript, refers to this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
This is very very rarely used so not sure what you’re looking at that refers to it.
literal
refers to syntax for representing a type of value
String literals:
"I am a string"
'I am also a string'
Number literals:
0
10
5.3
0b1101
Boolean literals
true
false
Object literals:
{ foo: 1, bar: 2}
{}
Array literals:
[]
[1,2,3]
Regex literals:
/foo/
/^\w{3}$/i
mad libs
It’s a game, absolutely nothing to do with JS, is confusing for non-US learners I think
https://en.m.wikipedia.org/wiki/Mad_Libs
appending. Append means add something to the end of something else. Definition doesn’t change to be JS-specific, still means same thing.
Not sure if you meant augment
or argument
. But just in case, argument
is the value passed to a function or method parameter.
// parameter userName
function logName(userName) {
console.log(userName) // salih
}
// argument 'salih'
logName('salih') // the string salih is the argument passed to the function parameter userName
The word resolve
may also come up when talking about a Promise
assign
and initialize
may be seen used interchangeably. However, initializing usually referrers to memory allocation and assignment to the value assigned to that memory allocation. In JS it doesn’t much matter as we don’t do manual allocation (or deallocation) and all variables are by default either automatically assigned a value (undefined) or an assignment is required at the place of declaration, i.e. variables declared using const
are required to be assigned a value when declared.
Hello!
I recommend you create your own forum topic so others can easily find and answer your question, rather than derailing the flow of conversation in this topic.