Adverb
Used to say that an occurrence, or situation, is not only fortunate, but that on the contrary, it could have been a lot worse; or that something that might at first seem bad is actually good because it could have been worse.
He missed the train, but just as well, it ended up crashing.
Used other than figuratively or idiomatically: see just, as well, as, well.
Source: en.wiktionary.org