If a language version is fairly old but the language is backwards compatible with that version, then there is generally no problem with giving an answer for that version.
If your solution works on an older version but doesn't work on the latest version (perhaps because it uses a deprecated feature), then it may still be worth posting your answer, especially if the question is difficult to answer otherwise; but you should mention in the answer that it won't work in recent versions.
In some specific cases there may be a solution which works for some version of the language, and doesn't work for earlier versions, but doesn't obviously not work for earlier versions. A notable example is Python's dictionaries, which have preserved insertion order since CPython 3.6 and Python 3.7. Answers relying on that feature will not work for earlier versions of Python, but it's likely they will silently give a wrong result, instead of failing in a more obvious way. In that case, it's again worth mentioning about the language version in your answer.
some code