Reputation: 595
I already tried using ? after every word, I already tried something like this:
const totalNameLenght = computed(() => {
if (userFirstnameLenght.value && userLastnameLenght.value){
return userFirstnameLenght.value + userLastnameLenght.value
}
})
also tried this one:
const totalNameLenght = computed((): number | undefined => )
I don't know what else to try... how should I solve this? Thanks in advance!
Upvotes: 1
Views: 552
Reputation: 111
you can try:
const totalNameLength = computed(() => {
return Number(userFirstnameLenght?.value ?? 0) + Number(userLastnameLenght?.value ?? 0)
})
Upvotes: 1