I'm really hoping this isn't a duplicate, although certainly possible and I'm just not searching the right terms.
I'm working on my own password strength checker based on flyingcars version.
And I'm trying to work out a way to combine two variables (only if both exist).
Here's what I've got:
var thisVal = $('.password_input').val(),
thisStrength = zxcvbn(thisVal),
thisMeter = $('.password_strength_meter'),
thisLabel = $('.password-text'),
thisSuggestion = $('.password-text-suggest');
thisSuggestion.text(thisStrength.feedback.warning + ". " thisStrength.feedback.suggestions);
If
Would the best way really be to do multiple if statements? Or is there some way of inlining it to the .text() section?
I'm considering extending this further perhaps, by including the time it would take to crack:
thisSuggestion.text(thisStrength.feedback.warning + ". This password could be cracked in: " + thisStrength.crack_times_display['online_no_throttling_10_per_second'] + ". " + thisStrength.feedback.suggestions);
so hopefully multiple if statements can be avoided.