Yes, you can embed JavaScript that will rate the password. SoSci Survey does this itself in the user account where you can change the password.
It depends, however, a lot on the algorithm that rates the passwort. For practical application, it's most important that the password is not listed in a public list of known passwords. "Have I been pwned" is the proper source for that,
But then, there are much more factors for how good a password is. And they depend on how some bad guy is attacking the password. In a brute force character based attack, the password "Ineverusegoodpasswords" would be quite strong, because it's long. If they use a dictionary-based brute force attack, it's weak, because it's made of (known) words.
So, before looking for the right JavaScript to rate the password, please work through some theory on good and bad passwords. With some luck, some of the reserachers provide you with the proper JavaScript then.