All the elements within the same group, in the periodic table of elements, have the same number of valence electrons. These are the electrons in the outer orbital. For example, the group 1 or alkali metals include hydrogen (H), lithium (Li), sodium (Na), potassium (K), rubidium (Rb), cesium (Cs) and francium (Fr). Each of these elements have 1 electron in the outer orbital.
For example, hydrogen has an atomic number of 1 and an electronic configuration of 1s1. Thus, it has 1 valence electron.
Similarly, lithium has an atomic number of 3 and an electronic configuration of 1s2, 2s1. Thus lithium also has 1 valence electron.
Similarly, all the other elements of group 1 also have the same number of valence electrons.
We can see the same for other groups of elements within our periodic table as well.
Hope this helps.