Physically, the MacBook Air will last a long time. I know of someone who is still using a MacBook from 2012. The only problem you will run into is that at some point you will not be able to update the operating system (commonly referred to as the macOS). For example the current macOS is Mojave (10.14). The following MacBooks and iMacs are eligible for Mojave.
- MacBook (Early 2015 or newer)
- MacBook Air (Mid 2012 or newer)
- MacBook Pro (Mid 2012 or newer)
- Mac mini (Late 2012 or newer)
- iMac (Late 2012 or newer)
- iMac Pro (2017)
- Mac Pro (Late 2013; Mid 2010 and Mid 2012 models