Depends on the job. Gas ones are heavier, smellier, and noisier, but they can go anywhere you need to go. You also have to dink around with mixing oil into gas in the right proportions and so keep a separate gas can just for it. Electric ones are far lighter, not smelly at all, and quite quiet by comparison, but you're limited to the length of your longest extension cord, which dinking around with extension cords can be as time consuming and frustrating as that whole mixing the gas thing..
They do make battery powered weed eaters, which is what I have. They're heavier than regular electric ones but lighter than gas. They can go anywhere a gas one can go, though. Their drawback is those rechargeable batteries they use only give you a few minutes of juice. I have two batteries and get a total of about 15 minutes out of them combined, which isn't enough time and there's only one charger and each battery takes 8 hours to charge. I mean, I'm literally sprinting around my yard with that sucker to try and get as much as I can before it runs out of juice. Also, even about halfway through a battery's juice, it starts slowing down a lot and not cutting as good. When I weed wack after mowing the lawn, I have to divide it up into two, sometimes three days because of the limitations of the batteries. It's not like I have sucky batteries, either. It's just a weed wacker takes a lot of juice and no portable battery is capable of sustaining that much juice for long.
Which one you'd choose would depend on your lawn and how far you needed to go with it. If I had a small lawn, like I used to, I'd use an electric one, like I used to. Now that I have 5 acres and sit back 150 feet from stuff that needs to be trimmed up by the road and around the mailbox and around the big trees out front, I've been using battery because I didn't know about the whole batter situation, so what I'm saying is I've been giving serious consideration to junking my battery-operated one and getting a gas one. That's because I'm presently cheating most of the time and using a gas-powered push lawnmower as a weed wacker in about half the places I should use a weed wacker, meaning I mow the lawn on my John Deere rider, but then butcher around the edges of what I can with the push mower so that I have a shot at getting all my weedwacking done in one shot and not having to go back out the next day with newly charged batteries.