Answers for "!! in javascript"

2

... in javascript

// The `...` operator breaks down an array to individual arguments.
// For example lets create an array,
let array = [1, 2, 3];

// And a function that will return a sum of 3 values.
function sum(x, y, z) {
	return(x + y + z);
}

// The `sum` function doesn't accept an array as a single argument,
// so a solution for this would be calling it individual indexes in the array:
sum(array[0], array[1], array[2]);

// Or we can just do:
sum(...array)
// does the same thing
Posted by: Guest on May-10-2022
1

What is $ in javascript

//----------------------------------------
//Question:What is ${variable_name} in javascript?
//----------------------------------------
//You can insert variables in a string (If you write string in backtick)
//Example
const username = "Omar";
//This will Work!
console.log(`The username is ${username}`)//The username is Omar
//These wont Work!
console.log("The username is ${username}")//The username is ${username}
console.log('The username is ${username}')//The username is ${username}
Posted by: Guest on December-30-2021
1

?. in javascript

The optional chaining operator (?.) enables you to read the value of a
property located deep within a chain of connected objects without having
to check that each reference in the chain is valid.
Posted by: Guest on March-24-2022
8

what is ... in javascript

function sum(...numbers) {
	return numbers.reduce((accumulator, current) => {
		return accumulator += current;
	});
};
 
sum(1,2) // 3
sum(1,2,3,4,5) // 15
Posted by: Guest on January-14-2020
-1

... in javascript

var i = 0;

var c = i++; //c = 0, i = 1
    c = ++i; //c = 2, i = 2
    //to make things more confusing:
    c = ++c + c++; //c = 6
    //but:
    c = c++ + c++; //c = 13
Posted by: Guest on February-18-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language