The repeating decimal places cycle every 6 places (142857 is 6 digits). Dividing 2018 by 6 gives 336 with a remainder of 2.
This means that there will be 336 repetitions of the entire cycle of 142857, which will go up to the 2016th digit. Then the 2017th and 2018th digits will begin from the start again, so the 2018th digit will be the 2nd digit in this repeating cycle, which is 4.