export default used to create a fallback value for a file or module.
what fallback means?
Fallback means the backup solution when all attempts fail. It hopefully prevents your program from breaking up by errors.
solution from a function !!! i still don’t get it
what do you mean by all attempts fail what attempts?all i know its a function inside a file that i can import
fallback means what happens when the current function fails e.g.
function example(){
let name = 'elmahdi'
if(name){
return `name is ${name}`
}else{
return `name is not defined`
}
console.log(example())
in the above example, you name is set but if you leave it empty e.g let name = ''
the function will fallback to else statement.
I assume you are referring to the wording from this challenge?
I’m still not sure why there is no explanation, nor why there is such a focus in the language used on it being a “fallback”. When I look at different sources like MDN and books I don’t really see this mentioned. MDN mentions it one time and even they do not explain what is meant by it.
Also:
exploringjs: 24.7.2 The default export as a named export (advanced)
Internally, a default export is simply a named export whose name is
default
.
I might make guesses as to what is meant by fallback, but that is not really the point of documentation.
yea thats exactly what i mean.