John 15:11 NASB
[11] These things I have spoken to you so that My joy may be in you, and that your joy may be made full.
John 16:33 NASB
[33] These things I have spoken to you, so that in Me you may have peace. In the world you have tribulation, but take courage; I have overcome the world.”
In these two verse,s Jesus said He spoke these things to them that they may have His joy in them and that they may, in Him, have peace. Notice that it is not just peace and joy that Jesus offers them, but it is His peace, and His joy that He offers them. This is not a joy and peace that has anything to do with circumstances, because Jesus said He offered them His peace and His joy even in this fallen world that is full of tribulation.
Real victory is not an environment lacking tribulation. The very word victory carries the idea of overcoming in the midst of tribulation. As a matter-of-fact, the promise of His peace is because Jesus said He overcame the world and all the tribulation that the world threw at Him. The things that He has been speaking to them about so that they would be able to experience His joy and His peace in the midst of tribulation was the truth of their union with Christ, which would be realized when the Holy Spirit would be poured out at Pentecost. By the presence of the Holy Spirit in them, the very life of Christ Himself would be realized in them. Therefore, the one who overcame the world would continue to overcome the world through them, no matter what the world would throw at them. Christ is the proven overcomer, and the proven overcomer lives inside of us. As long as we abide In Him we will experience His peace and His joy because He is confident in His ability to overcome any situation or temptation He might face living His life through us.
Jesus was speaking this message to them in this section of Scripture because after Pentecost, they would be facing many battles, but He wanted them to be comforted because they would be facing them in union with the indwelling Christ.